|
@@ -1,7 +1,7 @@
|
|
|
// ThreeExtras.js r32 - http://github.com/mrdoob/three.js
|
|
|
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
|
|
|
-THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,f,g,h,k,j;if(c==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
|
|
|
-setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
|
|
|
+var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
|
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,f,g,h,k,j;if(c==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();
|
|
|
+this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
|
|
|
this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
|
|
@@ -14,7 +14,7 @@ THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w
|
|
|
return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,v,I,q){q=q.clone().subSelf(v);I=I.clone().subSelf(v);var J=F.clone().subSelf(v);F=q.dot(q);v=q.dot(I);q=q.dot(J);var e=I.dot(I);I=I.dot(J);J=1/(F*e-v*v);e=(e*q-v*I)*J;F=(F*I-v*q)*J;return e>0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w,
|
|
|
-u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.rotationMatrix);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
|
|
|
+u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.matrixRotation);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotation.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
|
|
|
w))/o;w=w.addSelf(u.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
|
|
|
THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,w){k=!1;b=j;c=m;d=o;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
|
|
|
this.add3Points=function(j,m,o,w,u,t){if(k){k=!1;b=j<o?j<u?j:u:o<u?o:u;c=m<w?m<t?m:t:w<t?w:t;d=j>o?j>u?j:u:o>u?o:u;f=m>w?m>t?m:t:w>t?w:t}else{b=j<o?j<u?j<b?j:b:u<b?u:b:o<u?o<b?o:b:u<b?u:b;c=m<w?m<t?m<c?m:c:t<c?t:c:w<t?w<c?w:c:t<c?t:c;d=j>o?j>u?j>d?j:d:u>d?u:d:o>u?o>d?o:d:u>d?u:d;f=m>w?m>t?m>f?m:f:t>f?t:f:w>t?w>f?w:f:t>f?t:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
|
|
@@ -67,19 +67,19 @@ z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.
|
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(o){var w=[];b=0;for(c=o.length;b<c;b++)o[b]==undefined?w.push("undefined"):w.push(o[b].id);return w.join("_")}var b,c,d,f,g,h,k,j,m={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];
|
|
|
h=g.materials;k=a(h);m[k]==undefined&&(m[k]={hash:k,counter:0});j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0});g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+g>65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0})}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
|
|
|
-new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
|
|
|
+1;this.visible=!0};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)}};
|
|
|
THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
|
|
|
-THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
+THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Mesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};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.Mesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};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.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(d=
|
|
|
-0;d<f;d++)this.children[d].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}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(d=0;d<
|
|
|
+f;d++)this.children[d].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}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,k;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];g=f.pos;h=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];d=this.bones[c];
|
|
|
f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
|
|
|
+THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
|
|
|
THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
|
|
|
d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
|
|
@@ -87,16 +87,16 @@ THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materi
|
|
|
THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
|
|
|
THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
|
|
|
THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
|
|
|
-THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
|
+THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
|
this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
|
THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,w=this.hierarchy.length;o<w;o++){g=this.hierarchy[o];if(k[o][h]!==
|
|
|
-undefined){g.skinMatrix=k[o][h];g.autoUpdateMatrix=!1;g.matrixNeedsToUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.autoUpdateMatrix=!0;g.matrixNeedsToUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];
|
|
|
-f=f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
+undefined){g.skinMatrix=k[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=
|
|
|
+f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Camera=function(a,b,c,d,f,g){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
|
|
|
this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
|
|
|
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
|
|
|
this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
|
|
|
THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.zNear)return!1;if(h+g<-this.zFar)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,o=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(o+g<-this.screenCenterX)return!1;if(o-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
|
|
|
if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(o,b,h,g);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
@@ -144,8 +144,8 @@ THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light
|
|
|
THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
THREE.Projector=function(){function a(L,M){return M.z-L.z}function b(L,M){var V=0,S=1,Y=L.z+L.w,Z=M.z+M.w,G=-L.z+L.w,U=-M.z+M.w;if(Y>=0&&Z>=0&&G>=0&&U>=0)return!0;else if(Y<0&&Z<0||G<0&&U<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-U));else U<0&&(S=Math.min(S,G/(G-U)));if(S<V)return!1;else{L.lerpSelf(M,V);M.lerpSelf(L,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,w=[],u,t,x=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,I=new THREE.Matrix4,
|
|
|
q=[],J=new THREE.Vector4,e=new THREE.Vector4,ba;this.projectObjects=function(L,M,V){M=[];var S,Y,Z;d=0;Y=L.objects;L=0;for(S=Y.length;L<S;L++){Z=Y[L];var G;if(!(G=!Z.visible))if(G=Z instanceof THREE.Mesh){a:{G=void 0;for(var U=Z.globalMatrix,na=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),W=0;W<6;W++){G=q[W].x*U.n14+q[W].y*U.n24+q[W].z*U.n34+q[W].w;if(G<=na){G=!1;break a}}G=!0}G=!G}if(!G){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(Z.position);v.multiplyVector3(A);
|
|
|
-c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.near,Z=M.far,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H;k=o=t=0;M.autoUpdateMatrix&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);q[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,
|
|
|
-v.n43-v.n23,v.n44-v.n24);q[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);G=0;for(ia=q.length;G<ia;G++){$=q[G];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(G=ia.length;L<G;L++){$=ia[L].object;if($.visible){$.autoUpdateMatrix&&$.updateMatrix();ra=$.globalMatrix;ra.extractRotationMatrix($.rotationMatrix);z=$.rotationMatrix;ya=$.materials;
|
|
|
+c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.zNear,Z=M.zFar,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H;k=o=t=0;M.matrixAutoUpdate&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);q[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,
|
|
|
+v.n43-v.n23,v.n44-v.n24);q[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);G=0;for(ia=q.length;G<ia;G++){$=q[G];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(G=ia.length;L<G;L++){$=ia[L].object;if($.visible){$.matrixAutoUpdate&&$.updateMatrix();ra=$.globalMatrix;ra.extractRotationMatrix($.matrixRotation);z=$.matrixRotation;ya=$.materials;
|
|
|
l=$.overdraw;if($ instanceof THREE.Mesh){C=$.geometry;p=C.vertices;U=0;for(na=p.length;U<na;U++){n=p[U];n.positionWorld.copy(n.position);ra.multiplyVector3(n.positionWorld);W=n.positionScreen;W.copy(n.positionWorld);v.multiplyVector4(W);W.x/=W.w;W.y/=W.w;n.__visible=W.z>Y&&W.z<Z}C=C.faces;U=0;for(na=C.length;U<na;U++){n=C[U];if(n instanceof THREE.Face3){W=p[n.a];ka=p[n.b];B=p[n.c];if(W.__visible&&ka.__visible&&B.__visible&&($.doubleSided||$.flipSided!=(B.positionScreen.x-W.positionScreen.x)*(ka.positionScreen.y-
|
|
|
W.positionScreen.y)-(B.positionScreen.y-W.positionScreen.y)*(ka.positionScreen.x-W.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(B.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(B.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);
|
|
|
g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);B=n.vertexNormals;ba=g.vertexNormalsWorld;W=0;for(ka=B.length;W<ka;W++){H=ba[W]=ba[W]||new THREE.Vector3;H.copy(B[W]);z.multiplyVector3(H)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if($.geometry.uvs[U]){g.uvs[0]=$.geometry.uvs[U][0];g.uvs[1]=$.geometry.uvs[U][1];g.uvs[2]=$.geometry.uvs[U][2]}S.push(g);k++}}else if(n instanceof THREE.Face4){W=p[n.a];ka=p[n.b];B=p[n.c];H=p[n.d];if(W.__visible&&
|
|
@@ -225,9 +225,9 @@ light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLi
|
|
|
B=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":"",B.vertex_colors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
e.attachShader(C,I("fragment",n+ca));e.attachShader(C,I("vertex",B+z));e.linkProgram(C);e.getProgramParameter(C,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(C,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");C.uniforms={};C.attributes={};l.program=C;C=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(p in l.uniforms)C.push(p);p=l.program;ca=0;for(z=C.length;ca<
|
|
|
z;ca++){n=C[ca];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;C=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];ca=0;for(z=C.length;ca<z;ca++){n=C[ca];p.attributes[n]=e.getAttribLocation(p,n)}p=l.program.attributes;e.enableVertexAttribArray(p.position);p.color>=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
|
|
|
-0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,C,p){var n,B,H,N,ca,y,E,D,P=l.lights,T=l.fog;z.autoUpdateMatrix&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
+0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,C,p){var n,B,H,N,ca,y,E,D,P=l.lights,T=l.fog;z.matrixAutoUpdate&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
|
|
l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(C,p!==undefined?p:!0);this.autoClear&&this.clear();ca=l.__webGLObjects.length;for(p=0;p<ca;p++){n=l.__webGLObjects[p];E=n.object;if(E.visible)if(!(E instanceof THREE.Mesh)||m(E)){E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);u(n);n.render=!0;if(this.sortObjects){ia.copy(E.position);U.multiplyVector3(ia);n.z=ia.z}}else n.render=!1;else n.render=!1}this.sortObjects&&l.__webGLObjects.sort(t);y=l.__webGLObjectsImmediate.length;for(p=0;p<
|
|
|
-y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){E.autoUpdateMatrix&&E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,
|
|
|
+y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){E.matrixAutoUpdate&&E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,
|
|
|
B)})}}}for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,B)})}}}if(C&&C.min_filter!==THREE.NearestFilter&&C.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,C.__webGLTexture);
|
|
|
e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var z,C,p;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}z=0;for(C=l.objects.length;z<C;z++){p=l.objects[z];var n=l,B=void 0,H=void 0,N=void 0,ca=void 0;H=p.geometry;if(n.__webGLObjectsMap[p.id]==undefined){n.__webGLObjectsMap[p.id]={};p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);
|
|
|
p._objectMatrixArray=new Float32Array(16);p.globalMatrix.flattenToArray(p._objectMatrixArray)}ca=n.__webGLObjectsMap[p.id];objlist=n.__webGLObjects;if(p instanceof THREE.Mesh){for(B in H.geometryChunks){N=H.geometryChunks[B];if(!N.__webGLVertexBuffer){n=N;n.__webGLVertexBuffer=e.createBuffer();n.__webGLNormalBuffer=e.createBuffer();n.__webGLTangentBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n.__webGLUVBuffer=e.createBuffer();n.__webGLUV2Buffer=e.createBuffer();n.__webGLSkinVertexABuffer=
|
|
@@ -278,7 +278,7 @@ THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=ne
|
|
|
THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
|
THREE.Detector={canvas:!!window.CanvasRenderingContext2D,webgl:!!window.WebGLRenderingContext,workers:!!window.Worker,addGetWebGLMessage:function(a){var b=document.body,c="oldie";if(a){if(a.parent!==undefined)b=a.parent;if(a.id!==undefined)c=a.id}a=document.createElement("center");var d=document.createElement("div");d.innerHTML='Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>\n<br/>\nPlease try in\n<a href="http://www.google.com/chrome">Chrome 9+</a> /\n<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /\n<a href="http://nightly.webkit.org/">Safari OSX 10.6+</a>';d.id=
|
|
|
c;c=d.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.background="#eee";c.color="#000";c.padding="1em";c.width="475px";c.margin="5em auto 0";a.appendChild(d);b.appendChild(a);return d}};
|
|
|
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
|
|
|
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
|
|
|
d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();k.push(t)}o=0;for(w=f.length;o<w;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image;d.onload=function(){this.loaded=!0;c&&c(this)};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a,b){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<
|
|
|
d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=!0;b&&b(this)};f[c].src=a[c]}return f}};if(!window.requestAnimationFrame)window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();
|
|
|
var SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in L.objects)if(!G.objects[o]){A=L.objects[o];if(q=G.geometries[A.geometry]){ba=[];for(i=0;i<A.materials.length;i++)ba[i]=G.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(q,ba);object.position.set(F[0],F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;G.scene.addObject(object);G.objects[o]=
|