2
0
Mr.doob 13 жил өмнө
parent
commit
3cff346d88
3 өөрчлөгдсөн 60 нэмэгдсэн , 6 устгасан
  1. 44 0
      README.md
  2. 12 2
      build/three.js
  3. 4 4
      build/three.min.js

+ 44 - 0
README.md

@@ -65,6 +65,50 @@ This code creates a scene, then creates a camera, adds the camera and cube to th
 
 ### Change log ###
 
+2012 08 15 - **r50** (391,250 KB, gzip: 96,143 KB)
+
+* Experimenting with `SoftwareRenderer`. ([mrdoob](http://github.com/mrdoob) and [rygorous](http://github.com/rygorous))
+* Improved rotation conversion routines. ([WestLangley](http://github.com/WestLangley))
+* Moved `DOMRenderer` and `SVGRenderer` out of common build. ([mrdoob](http://github.com/mrdoob))
+* Improvements to Morph targets. ([alteredq](http://github.com/alteredq) and [gero3](http://github.com/gero3))
+* Added `.deallocateMaterial` method to `WebGLRenderer`. ([alteredq](http://github.com/alteredq))
+* Added `.worldToLocal` and `.localToWorld` methods to `Object3D`. ([zz85](http://github.com/zz85) and [WestLangley](http://github.com/WestLangley))
+* Added `ConvexGeometry`. ([qiao](http://github.com/qiao))
+* Added node.js build system. ([gero3](http://github.com/gero3))
+* Improvements to Blender exporter. ([timbot](http://github.com/timbot) and [alteredq](http://github.com/alteredq))
+* Added uvs and vertex colors support to `ImmediateRenderObjects`. ([alteredq](http://github.com/alteredq))
+* Started implementing `LoadingMonitor` and `EventTarget` in loaders. ([mrdoob](http://github.com/mrdoob))
+* Added `Path.ellipse`. ([linzhp](http://github.com/linzhp))
+* Added `near` and `far` properties to `Ray`. ([niklassa](http://github.com/niklassa))
+* Added `OrbitControls`. ([qiao](http://github.com/qiao), [mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))
+* Completed some more documentation pages. ([mrdoob](http://github.com/mrdoob), [phenomnomnominal](http://github.com/phenomnomnominal), [FuzzYspo0N](http://github.com/FuzzYspo0N), [poeschko](http://github.com/poeschko), [wwwtyro](http://github.com/wwwtyro), [maximeq](http://github.com/maximeq) and [alteredq](http://github.com/alteredq))
+* Completed lots more documentation pages. ([sole](http://github.com/sole))
+* Started reworking [GUI](http://mrdoob.github.com/three.js/gui/). ([mrdoob](http://github.com/mrdoob))
+* Improved python build system. ([gero3](http://github.com/gero3))
+* Made `VTKLoader` parsing more robust. ([mrdoob](http://github.com/mrdoob))
+* Added `recursive` flag to `Ray`. ([mrdoob](http://github.com/mrdoob))
+* Handling resizes properly in controls and examples. ([alteredq](http://github.com/alteredq))
+* Improvements to ColladaLoader. ([spacecookies](http://github.com/spacecookies))
+* Unflipped V coordinate across the whole library. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))
+* Refactored `BufferGeometry`. ([alteredq](http://github.com/alteredq))
+* Improved GL extensions initialisation in `WebGLRenderer`. ([alteredq](http://github.com/alteredq))
+* Rescued `SkinnedMesh`. ([n3tfr34k](http://github.com/n3tfr34k) and [alteredq](http://github.com/alteredq))
+* Made `OBJLoader` parsing more robust. ([Dahie](http://github.com/Dahie))
+* Implemented skinning via floating point textures. ([alteredq](http://github.com/alteredq))
+* Improved documentation system. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))
+* Added support for anisotropic texture filtering and standard derivatives in `WebGLRenderer`. ([alteredq](http://github.com/alteredq))
+* Added support for `ParticleBasicMaterial` without `map` in `CanvasRenderer`. ([mrdoob](http://github.com/mrdoob))
+* `SceneLoader` now supports nested scene graphs and per object custom properties. ([skfcz](http://github.com/skfcz))
+* `Camera` doesn't need to be added to the scene anymore. ([mrdoob](http://github.com/mrdoob))
+* `Object3D`'s `flipSided` and `doubleSided` properties are now `Material`'s `side` property. ([alteredq](http://github.com/alteredq) and [mrdoob](http://github.com/mrdoob))
+* Added `.clone` method to `*Material`. ([gero3](http://github.com/gero3), [mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))
+* [IEWEBGL](http://iewebgl.com/Engines.aspx#ThreeJS) support. ([mrdoob](http://github.com/mrdoob))
+* Added `CircleGeometry`. ([hughes](http://github.com/hughes))
+* Added `bumpMap` to `MeshPhongMaterial`. ([alteredq](http://github.com/alteredq))
+* Added `specularMap` to `MeshBasicMaterial`, `MeshLambertMaterial` and `MeshPhongMaterial`. ([alteredq](http://github.com/alteredq))
+* Reworked python build system. ([mrdoob](http://github.com/mrdoob))
+
+
 2012 04 22 - **r49** (364,242 KB, gzip: 89,057 KB)
 
 * Yet more `ColladaLoader` improvements. ([ekitson](http://github.com/ekitson), [AddictArts](http://github.com/AddictArts) and [pblasco](http://github.com/pblasco))

+ 12 - 2
build/three.js

@@ -1671,7 +1671,12 @@ THREE.Ray = function ( origin, direction, near, far ) {
 			rangeSq = this.range * this.range,
 			geometry = object.geometry,
 			vertices = geometry.vertices,
-			objMatrix;
+			objMatrix, geometryMaterials,
+			isFaceMaterial, material, side;
+
+			geometryMaterials = object.geometry.materials;
+			isFaceMaterial = object.material instanceof THREE.MeshFaceMaterial;
+			side = object.material.side;
 
 			object.matrixRotationWorld.extractRotation( object.matrixWorld );
 
@@ -1679,6 +1684,11 @@ THREE.Ray = function ( origin, direction, near, far ) {
 
 				face = geometry.faces[ f ];
 
+				material = isFaceMaterial === true ? geometryMaterials[ face.materialIndex ] : object.material;
+				if ( material === undefined ) continue;
+
+				side = material.side;
+
 				originCopy.copy( this.origin );
 				directionCopy.copy( this.direction );
 
@@ -1703,7 +1713,7 @@ THREE.Ray = function ( origin, direction, near, far ) {
 
 				if ( scalar < 0 ) continue;
 
-				if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) {
+				if ( side === THREE.DoubleSide || ( side === THREE.FrontSide ? dot < 0 : dot > 0 ) ) {
 
 					intersectPoint.add( originCopy, directionCopy.multiplyScalar( scalar ) );
 

+ 4 - 4
build/three.min.js

@@ -33,10 +33,10 @@ THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),f=0;f<6;f++){b=c[f].x*d[12]+c[f].y*d[13]+c[f].z*d[14]+c[f].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
 THREE.Ray=function(a,b,c,d){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.near=c||0;this.far=d||Infinity;var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=function(a,b){return a.distance-b.distance},q=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,s,t,u,z=function(a,b,c){q.sub(c,a);s=q.dot(b);t=n.add(a,r.copy(b).multiplyScalar(s));
 return u=c.distanceTo(t)},x,A,B,C,v,J,F,O,P=function(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);x=q.dot(q);A=q.dot(n);B=q.dot(r);C=n.dot(n);v=n.dot(r);J=1/(x*C-A*A);F=(C*B-A*v)*J;O=(x*v-A*B)*J;return F>=0&&O>=0&&F+O<1},G=1E-4;this.setPrecision=function(a){G=a};this.intersectObject=function(a,b){var c,d=[];if(b===true)for(var n=0,q=a.children.length;n<q;n++)Array.prototype.push.apply(d,this.intersectObject(a.children[n],b));if(a instanceof THREE.Particle){u=z(this.origin,this.direction,a.matrixWorld.getPosition());
-if(u>a.scale.x)return[];c={distance:u,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){n=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());n=a.geometry.boundingSphere.radius*Math.max(n.x,Math.max(n.y,n.z));u=z(this.origin,this.direction,a.matrixWorld.getPosition());if(u>n)return d;var r,s,t=a.geometry,v=t.vertices,x;a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(q=t.faces.length;n<
-q;n++){c=t.faces[n];i.copy(this.origin);j.copy(this.direction);x=a.matrixWorld;l=x.multiplyVector3(l.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));r=j.dot(o);if(!(Math.abs(r)<G)){s=o.dot(l)/r;if(!(s<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))){m.add(i,j.multiplyScalar(s));u=i.distanceTo(m);if(!(u<this.near)&&!(u>this.far))if(c instanceof THREE.Face3){f=x.multiplyVector3(f.copy(v[c.a]));e=x.multiplyVector3(e.copy(v[c.b]));g=x.multiplyVector3(g.copy(v[c.c]));
-if(P(m,f,e,g)){c={distance:u,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=x.multiplyVector3(f.copy(v[c.a]));e=x.multiplyVector3(e.copy(v[c.b]));g=x.multiplyVector3(g.copy(v[c.c]));h=x.multiplyVector3(h.copy(v[c.d]));if(P(m,f,e,h)||P(m,e,g,h)){c={distance:u,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}}}}}d.sort(p);return d};this.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],
-b));c.sort(p);return c}};
+if(u>a.scale.x)return[];c={distance:u,point:a.position,face:null,object:a};d.push(c)}else if(a instanceof THREE.Mesh){n=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());n=a.geometry.boundingSphere.radius*Math.max(n.x,Math.max(n.y,n.z));u=z(this.origin,this.direction,a.matrixWorld.getPosition());if(u>n)return d;var r,s,t=a.geometry,v=t.vertices,x,A,C,B;A=a.geometry.materials;C=a.material instanceof THREE.MeshFaceMaterial;
+a.matrixRotationWorld.extractRotation(a.matrixWorld);n=0;for(q=t.faces.length;n<q;n++){c=t.faces[n];r=C===true?A[c.materialIndex]:a.material;if(r!==void 0){B=r.side;i.copy(this.origin);j.copy(this.direction);x=a.matrixWorld;l=x.multiplyVector3(l.copy(c.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(c.normal));r=j.dot(o);if(!(Math.abs(r)<G)){s=o.dot(l)/r;if(!(s<0)&&(B===THREE.DoubleSide||(B===THREE.FrontSide?r<0:r>0))){m.add(i,j.multiplyScalar(s));u=i.distanceTo(m);if(!(u<this.near)&&
+!(u>this.far))if(c instanceof THREE.Face3){f=x.multiplyVector3(f.copy(v[c.a]));e=x.multiplyVector3(e.copy(v[c.b]));g=x.multiplyVector3(g.copy(v[c.c]));if(P(m,f,e,g)){c={distance:u,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}else if(c instanceof THREE.Face4){f=x.multiplyVector3(f.copy(v[c.a]));e=x.multiplyVector3(e.copy(v[c.b]));g=x.multiplyVector3(g.copy(v[c.c]));h=x.multiplyVector3(h.copy(v[c.d]));if(P(m,f,e,h)||P(m,e,g,h)){c={distance:u,point:m.clone(),face:c,faceIndex:n,object:a};d.push(c)}}}}}}}d.sort(p);
+return d};this.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)Array.prototype.push.apply(c,this.intersectObject(a[d],b));c.sort(p);return c}};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,l,o){h=false;b=e;c=g;d=l;f=o;a()};this.addPoint=function(e,g){if(h===true){h=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:
 g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,l,o,m,p){if(h===true){h=false;b=e<l?e<m?e:m:l<m?l:m;c=g<o?g<p?g:p:o<p?o:p;d=e>l?e>m?e:m:l>m?l:m;f=g>o?g>p?g:p:o>p?o:p}else{b=e<l?e<m?e<b?e:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=e>l?e>m?e>d?e:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;f=g>o?g>p?g>f?g:f:p>f?p:f:o>p?o>f?o:f:p>f?p:f}a()};this.addRectangle=function(e){if(h===true){h=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
 c=c<e.getTop()?c:e.getTop();d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;f=d=c=b=0;a()};this.isEmpty=function(){return h}};