Browse Source

Synced with mrdoob's branch.

alteredq 14 years ago
parent
commit
043f42bd91
4 changed files with 15 additions and 15 deletions
  1. 1 1
      build/Three.js
  2. 1 1
      build/custom/ThreeExtras.js
  3. 1 1
      src/core/Color.js
  4. 12 12
      src/extras/io/JSONLoader.js

+ 1 - 1
build/Three.js

@@ -448,7 +448,7 @@ h;y.position.y=p[o++]/h;y.position.z=p[o++]/h;f.vertices.push(y)}o=0;for(t=R.len
 D=B[A*2];A=B[A*2+1];W[k]=new THREE.UV(D,A)}f.faceVertexUvs[j][m]=W}if(u){u=R[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];H.normal=k}if(y)for(j=0;j<p;j++){u=R[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];H.vertexNormals.push(k)}if(I){y=R[o++];y=new THREE.Color(Q[y]);H.color=y}if(h)for(j=0;j<p;j++){y=R[o++];y=new THREE.Color(Q[y]);H.vertexColors.push(y)}f.faces.push(H)}}})(g);(function(){var h,j,k,m;if(b.skinWeights){h=0;for(j=b.skinWeights.length;h<j;h+=2){k=b.skinWeights[h];
 m=b.skinWeights[h+1];f.skinWeights.push(new THREE.Vector4(k,m,0,0))}}if(b.skinIndices){h=0;for(j=b.skinIndices.length;h<j;h+=2){k=b.skinIndices[h];m=b.skinIndices[h+1];f.skinIndices.push(new THREE.Vector4(k,m,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(h){if(b.morphTargets!==undefined){var j,k,m,o,t,p,y,u,A;j=0;for(k=b.morphTargets.length;j<k;j++){f.morphTargets[j]={};f.morphTargets[j].name=b.morphTargets[j].name;f.morphTargets[j].vertices=[];u=f.morphTargets[j].vertices;A=b.morphTargets[j].vertices;
 m=0;for(o=A.length;m<o;m+=3){t=A[m]/h;p=A[m+1]/h;y=A[m+2]/h;u.push(new THREE.Vertex(new THREE.Vector3(t,p,y)))}}}if(b.morphColors!==undefined){j=0;for(k=b.morphColors.length;j<k;j++){f.morphColors[j]={};f.morphColors[j].name=b.morphColors[j].name;f.morphColors[j].colors=[];o=f.morphColors[j].colors;t=b.morphColors[j].colors;h=0;for(m=t.length;h<m;h+=3){p=new THREE.Color(16755200);p.setRGB(t[h],t[h+1],t[h+2]);o.push(p)}}}})(g);(function(){if(b.edges!==undefined){var h,j,k;for(h=0;h<b.edges.length;h+=
-2){j=b.edges[h];k=b.edges[h+1];f.edges.push(new THREE.Edge(f.vertices[j],f.vertices[k],j,k))}}})();f.computeCentroids();f.computeFaceNormals();f.computeEdgeFaces();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+2){j=b.edges[h];k=b.edges[h+1];f.edges.push(new THREE.Edge(f.vertices[j],f.vertices[k],j,k))}}})();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
 j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(S,T){var O=t(S,T),Ba=t(S,T+1),La=t(S,T+2),n=t(S,T+3),C=(n<<1&255|La>>7)-127;O|=(La&127)<<16|Ba<<8;if(O==0&&C==-127)return 0;return(1-2*(n>>7))*(1+O*Math.pow(2,-23))*Math.pow(2,C)}function k(S,T){var O=t(S,T),Ba=t(S,T+1),La=t(S,T+2);return(t(S,T+3)<<24)+(La<<16)+(Ba<<8)+O}function m(S,T){var O=t(S,T);return(t(S,T+1)<<8)+O}function o(S,T){var O=t(S,T);return O>127?O-256:O}function t(S,

+ 1 - 1
build/custom/ThreeExtras.js

@@ -106,7 +106,7 @@ p.position.y=m[l++]/d;p.position.z=m[l++]/d;e.vertices.push(p)}l=0;for(k=z.lengt
 u[v*2];v=u[v*2+1];y[h]=new THREE.UV(o,v)}e.faceVertexUvs[g][j]=y}if(n){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.normal=h}if(p)for(g=0;g<m;g++){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.vertexNormals.push(h)}if(A){p=z[l++];p=new THREE.Color(I[p]);w.color=p}if(d)for(g=0;g<m;g++){p=z[l++];p=new THREE.Color(I[p]);w.vertexColors.push(p)}e.faces.push(w)}}})(f);(function(){var d,g,h,j;if(a.skinWeights){d=0;for(g=a.skinWeights.length;d<g;d+=2){h=a.skinWeights[d];
 j=a.skinWeights[d+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){d=0;for(g=a.skinIndices.length;d<g;d+=2){h=a.skinIndices[d];j=a.skinIndices[d+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(d){if(a.morphTargets!==undefined){var g,h,j,l,k,m,p,n,v;g=0;for(h=a.morphTargets.length;g<h;g++){e.morphTargets[g]={};e.morphTargets[g].name=a.morphTargets[g].name;e.morphTargets[g].vertices=[];n=e.morphTargets[g].vertices;v=a.morphTargets[g].vertices;
 j=0;for(l=v.length;j<l;j+=3){k=v[j]/d;m=v[j+1]/d;p=v[j+2]/d;n.push(new THREE.Vertex(new THREE.Vector3(k,m,p)))}}}if(a.morphColors!==undefined){g=0;for(h=a.morphColors.length;g<h;g++){e.morphColors[g]={};e.morphColors[g].name=a.morphColors[g].name;e.morphColors[g].colors=[];l=e.morphColors[g].colors;k=a.morphColors[g].colors;d=0;for(j=k.length;d<j;d+=3){m=new THREE.Color(16755200);m.setRGB(k[d],k[d+1],k[d+2]);l.push(m)}}}})(f);(function(){if(a.edges!==undefined){var d,g,h;for(d=0;d<a.edges.length;d+=
-2){g=a.edges[d];h=a.edges[d+1];e.edges.push(new THREE.Edge(e.vertices[g],e.vertices[h],g,h))}}})();e.computeCentroids();e.computeFaceNormals();e.computeEdgeFaces();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+2){g=a.edges[d];h=a.edges[d+1];e.edges.push(new THREE.Edge(e.vertices[g],e.vertices[h],g,h))}}})();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var d=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,f,e,d)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,d){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(d){j==0&&(j=g.getResponseHeader("Content-Length"));d({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,e){var f=function(d){function g(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2),T=k(t,x+3),V=(T<<1&255|H>>7)-127;C|=(H&127)<<16|E<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2);return(k(t,x+3)<<24)+(H<<16)+(E<<8)+C}function j(t,x){var C=k(t,x);return(k(t,x+1)<<8)+C}function l(t,x){var C=k(t,x);return C>127?C-256:C}function k(t,

+ 1 - 1
src/core/Color.js

@@ -81,7 +81,7 @@ THREE.Color.prototype = {
 
 		}
 
-	},	
+	},
 
 	setHex : function ( hex ) {
 

+ 12 - 12
src/extras/io/JSONLoader.js

@@ -50,17 +50,17 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	this.init_materials( geometry, json.materials, texture_path );
 
-	init_model( scale );
+	parseModel( scale );
 
-	init_skin();
-	init_morphing( scale );
-	init_edges();
+	parseSkin();
+	parseMorphing( scale );
+	parseEdges();
 
-	geometry.computeCentroids();
 	geometry.computeFaceNormals();
-	geometry.computeEdgeFaces();
+	// geometry.computeCentroids();
+	// geometry.computeEdgeFaces();
 
-	function init_model( scale ) {
+	function parseModel( scale ) {
 
 		if ( json.version === undefined || json.version != 2 ) {
 
@@ -82,8 +82,8 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		colorIndex, normalIndex, uvIndex, materialIndex,
 
 		type,
-		isQuad, 
-		hasMaterial, 
+		isQuad,
+		hasMaterial,
 		hasFaceUv, hasFaceVertexUv,
 		hasFaceNormal, hasFaceVertexNormal,
 		hasFaceColor, hasFaceVertexColor,
@@ -286,7 +286,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	};
 
-	function init_skin() {
+	function parseSkin() {
 
 		var i, l, x, y, z, w, a, b, c, d;
 
@@ -325,7 +325,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	};
 
-	function init_morphing( scale ) {
+	function parseMorphing( scale ) {
 
 		if ( json.morphTargets !== undefined ) {
 
@@ -381,7 +381,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	};
 
-	function init_edges() {
+	function parseEdges() {
 
 		if( json.edges !== undefined ) {