提交 952631c9 编写于 作者: M Mr.doob

REVISION++

Added some examples to README.
上级 2a6be883
......@@ -5,7 +5,7 @@ three.js
The aim of this project is to create a lightweight 3D engine with a very low level of abstraction — in other words, for dummies. The engine can render using <canvas>, <svg> and WebGL.
[API Reference](https://github.com/mrdoob/three.js/wiki/r34-API-Reference) — be aware that the API may change from revision to revision breaking backwards compatibility.
[API Reference](https://github.com/mrdoob/three.js/wiki/r35-API-Reference) — be aware that the API may change from revision to revision breaking backwards compatibility.
More? [#three.js on irc.freenode.net](http://webchat.freenode.net/?channels=three.js)
......@@ -14,6 +14,8 @@ More? [#three.js on irc.freenode.net](http://webchat.freenode.net/?channels=thre
#### WebGL (Context 3D) ####
[![scissors](http://mrdoob.github.com/three.js/assets/examples/42_scissors.png)](http://mrdoob.github.com/three.js/examples/webgl_materials_texture_filters.html)
[![lookat](http://mrdoob.github.com/three.js/assets/examples/41_lookat.png)](http://mrdoob.github.com/three.js/examples/misc_lookat.html)
[![video](http://mrdoob.github.com/three.js/assets/examples/40_video.png)](http://mrdoob.github.com/three.js/examples/webgl_materials_video.html)
[![dof](http://mrdoob.github.com/three.js/assets/examples/39_dof.png)](http://mrdoob.github.com/three.js/examples/webgl_postprocessing_dof.html)
[![ribbon](http://mrdoob.github.com/three.js/assets/examples/38_ribbon.png)](http://mrdoob.github.com/three.js/examples/webgl_ribbons.html)
......@@ -134,6 +136,14 @@ This code creates a camera, then creates a scene object, adds a bunch of random
### Change Log ###
2011 03 06 - **r35** (188.029 KB, gzip: 46.465 KB)
* Added methods `translate`, `translateX`, `translateY`, `translateZ` and `lookAt` methods to `Object3D`. ([mrdoob](http://github.com/mrdoob))
* Added methods `setViewport` and `setScissor` to `WebGLRenderer`. ([alteredq](http://github.com/alteredq))
* Added support for non-po2 textures. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq))
* Minor API clean up. ([mrdoob](http://github.com/mrdoob))
2011 03 02 - **r34** (186.045 KB, gzip: 45.953 KB)
* Now using camera.matrixWorldInverse instead of camera.matrixWorld for projecting. ([empaempa](http://github.com/empaempa) and [mrdoob](http://github.com/mrdoob))
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
// ThreeExtras.js r34 - http://github.com/mrdoob/three.js
// ThreeExtras.js r35 - http://github.com/mrdoob/three.js
var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,f=a.vertices.length,h=b?d.geometry:d,c=a.vertices,e=h.vertices,g=a.faces,j=h.faces,m=a.uvs;h=h.uvs;b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,v=e.length;k<v;k++){var q=new THREE.Vertex(e[k].position.clone());b&&d.matrix.multiplyVector3(q.position);c.push(q)}k=0;for(v=j.length;k<v;k++){e=j[k];var n,p=e.vertexNormals;if(e instanceof THREE.Face3)n=new THREE.Face3(e.a+f,e.b+f,e.c+f);else e instanceof THREE.Face4&&(n=new THREE.Face4(e.a+
f,e.b+f,e.c+f,e.d+f));n.centroid.copy(e.centroid);n.normal.copy(e.normal);b=0;for(c=p.length;b<c;b++){q=p[b];n.vertexNormals.push(q.clone())}n.materials=e.materials.slice();g.push(n)}k=0;for(v=h.length;k<v;k++){f=h[k];g=[];b=0;for(c=f.length;b<c;b++)g.push(new THREE.UV(f[b].u,f[b].v));m.push(g)}}},ImageUtils={loadTexture:function(a,d,b){var f=new Image,h=new THREE.Texture(f,d);f.onload=function(){h.needsUpdate=!0;b&&b(this)};f.src=a;return h},loadTextureCube:function(a,d,b){var f,h=[],c=new THREE.Texture(h,
d);d=h.loadCount=0;for(f=a.length;d<f;++d){h[d]=new Image;h[d].onload=function(){h.loadCount+=1;if(h.loadCount==6)c.needsUpdate=!0;b&&b(this)};h[d].src=a[d]}return c}},SceneUtils={loadScene:function(a,d,b,f){a=new Worker(a);a.postMessage(0);a.onmessage=function(h){function c(){for(k in C.objects)if(!G.objects[k]){u=C.objects[k];if(l=G.geometries[u.geometry]){I=[];for(i=0;i<u.materials.length;i++)I[i]=G.materials[u.materials[i]];z=u.position;r=u.rotation;s=u.scale;object=new THREE.Mesh(l,I);object.position.set(z[0],
......@@ -38,7 +38,7 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var g in c.faces){var j=f(c.faces[g].a,c.faces[g].b),m=f(c.faces[g].b,c.faces[g].c),k=f(c.faces[g].c,c.faces[g].a);b(c.faces[g].a,j,k,e);b(c.faces[g].b,m,j,e);b(c.faces[g].c,
k,m,e);b(j,m,k,e)}c.faces=e.faces}h.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
c[g]=this.vertices.length-1}else c=e;m==0&&(e=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(c[g],c[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(m/b,g/a.length),new THREE.UV(m/b,(g+1)/a.length),new THREE.UV((m-d)/b,(g+1)/a.length),new THREE.UV((m-d)/b,g/a.length)])}h=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册