浏览代码

Removed UTF8Loader

Mr.doob 7 年之前
父节点
当前提交
b688e4bfd6
共有 35 个文件被更改,包括 0 次插入1247 次删除
  1. 0 1
      examples/files.js
  2. 0 752
      examples/js/loaders/UTF8Loader.js
  3. 二进制
      examples/models/utf8/James_Body_Lores.jpg
  4. 二进制
      examples/models/utf8/James_EyeLashBotTran.png
  5. 二进制
      examples/models/utf8/James_EyeLashTopTran.png
  6. 二进制
      examples/models/utf8/James_Eye_Green.jpg
  7. 二进制
      examples/models/utf8/James_Eye_Inner_Green.jpg
  8. 二进制
      examples/models/utf8/James_Face_Color_Hair_Lores.jpg
  9. 二进制
      examples/models/utf8/James_Mouth_Gum_Lores.jpg
  10. 二进制
      examples/models/utf8/James_Tongue_Lores.jpg
  11. 二进制
      examples/models/utf8/MCasShoe1TEX_Lores.jpg
  12. 二进制
      examples/models/utf8/MJeans1TEX_Lores.jpg
  13. 二进制
      examples/models/utf8/MTshirt3TEX_Lores.jpg
  14. 二进制
      examples/models/utf8/Nail_Hand_01_Lores.jpg
  15. 0 21
      examples/models/utf8/WaltHi.js
  16. 二进制
      examples/models/utf8/WaltHi.utf8
  17. 0 107
      examples/models/utf8/ben.js
  18. 二进制
      examples/models/utf8/ben.utf8
  19. 0 107
      examples/models/utf8/ben_dds.js
  20. 二进制
      examples/models/utf8/dds/James_Body_Lores.dds
  21. 二进制
      examples/models/utf8/dds/James_EyeLashBotTran.dds
  22. 二进制
      examples/models/utf8/dds/James_EyeLashTopTran.dds
  23. 二进制
      examples/models/utf8/dds/James_Eye_Green.dds
  24. 二进制
      examples/models/utf8/dds/James_Eye_Inner_Green.dds
  25. 二进制
      examples/models/utf8/dds/James_Face_Color_Hair_Lores.dds
  26. 二进制
      examples/models/utf8/dds/James_Mouth_Gum_Lores.dds
  27. 二进制
      examples/models/utf8/dds/James_Tongue_Lores.dds
  28. 二进制
      examples/models/utf8/dds/MCasShoe1TEX_Lores.dds
  29. 二进制
      examples/models/utf8/dds/MJeans1TEX_Lores.dds
  30. 二进制
      examples/models/utf8/dds/MTshirt3TEX_Lores.dds
  31. 二进制
      examples/models/utf8/dds/Nail_Hand_01_Lores.dds
  32. 二进制
      examples/models/utf8/hand.jpg
  33. 0 27
      examples/models/utf8/hand.js
  34. 二进制
      examples/models/utf8/hand.utf8
  35. 0 232
      examples/webgl_loader_utf8.html

+ 0 - 1
examples/files.js

@@ -132,7 +132,6 @@ var files = {
 		"webgl_loader_texture_pvrtc",
 		"webgl_loader_texture_tga",
 		"webgl_loader_ttf",
-		"webgl_loader_utf8",
 		"webgl_loader_vrm",
 		"webgl_loader_vrml",
 		"webgl_loader_vtk",

+ 0 - 752
examples/js/loaders/UTF8Loader.js

@@ -1,752 +0,0 @@
-/**
- * Loader for UTF8 version2 (after r51) encoded models generated by:
- *	http://code.google.com/p/webgl-loader/
- *
- * Code to load/decompress mesh is taken from r100 of this webgl-loader
- */
-
-THREE.UTF8Loader = function () {};
-
-/**
- * Load UTF8 encoded model
- * @param jsonUrl - URL from which to load json containing information about model
- * @param callback - Callback(THREE.Object3D) on successful loading of model
- * @param options - options on how to load model (see THREE.MTLLoader.MaterialCreator for basic options)
- *                  Additional options include
- *                   geometryBase: Base url from which to load referenced geometries
- *                   materialBase: Base url from which to load referenced textures
- */
-
-THREE.UTF8Loader.prototype.load = function ( jsonUrl, callback, options ) {
-
-	this.downloadModelJson( jsonUrl, callback, options );
-
-};
-
-// BufferGeometryCreator
-
-THREE.UTF8Loader.BufferGeometryCreator = function () {
-};
-
-THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray, indices ) {
-
-	var ntris = indices.length / 3;
-
-	var geometry = new THREE.BufferGeometry();
-
-	var positions = new Float32Array( ntris * 3 * 3 );
-	var normals = new Float32Array( ntris * 3 * 3 );
-	var uvs = new Float32Array( ntris * 3 * 2 );
-
-	var i, j, offset;
-
-	var end = attribArray.length;
-	var stride = 8;
-
-	// extract positions
-
-	j = 0;
-	offset = 0;
-
-	for ( i = offset; i < end; i += stride ) {
-
-		positions[ j ++ ] = attribArray[ i ];
-		positions[ j ++ ] = attribArray[ i + 1 ];
-		positions[ j ++ ] = attribArray[ i + 2 ];
-
-	}
-
-	// extract uvs
-
-	j = 0;
-	offset = 3;
-
-	for ( i = offset; i < end; i += stride ) {
-
-		uvs[ j ++ ] = attribArray[ i ];
-		uvs[ j ++ ] = attribArray[ i + 1 ];
-
-	}
-
-	// extract normals
-
-	j = 0;
-	offset = 5;
-
-	for ( i = offset; i < end; i += stride ) {
-
-		normals[ j ++ ] = attribArray[ i ];
-		normals[ j ++ ] = attribArray[ i + 1 ];
-		normals[ j ++ ] = attribArray[ i + 2 ];
-
-	}
-
-	geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
-	geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
-	geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
-	geometry.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
-
-	geometry.computeBoundingSphere();
-
-	return geometry;
-
-};
-
-
-// UTF-8 decoder from webgl-loader (r100)
-// http://code.google.com/p/webgl-loader/
-
-// Model manifest description. Contains objects like:
-// name: {
-//   materials: { 'material_name': { ... } ... },
-//   decodeParams: {
-//     decodeOffsets: [ ... ],
-//     decodeScales: [ ... ],
-//   },
-//   urls: {
-//     'url': [
-//       { material: 'material_name',
-//         attribRange: [#, #],
-//         indexRange: [#, #],
-//         names: [ 'object names' ... ],
-//         lengths: [#, #, # ... ]
-//       }
-//     ],
-//     ...
-//   }
-// }
-
-var DEFAULT_DECODE_PARAMS = {
-
-	decodeOffsets: [ - 4095, - 4095, - 4095, 0, 0, - 511, - 511, - 511 ],
-	decodeScales: [ 1 / 8191, 1 / 8191, 1 / 8191, 1 / 1023, 1 / 1023, 1 / 1023, 1 / 1023, 1 / 1023 ]
-
-	// TODO: normal decoding? (see walt.js)
-	// needs to know: input, output (from vertex format!)
-	//
-	// Should split attrib/index.
-	// 1) Decode position and non-normal attributes.
-	// 2) Decode indices, computing normals
-	// 3) Maybe normalize normals? Only necessary for refinement, or fixed?
-	// 4) Maybe refine normals? Should this be part of regular refinement?
-	// 5) Morphing
-
-};
-
-// Triangle strips!
-
-// TODO: will it be an optimization to specialize this method at
-// runtime for different combinations of stride, decodeOffset and
-// decodeScale?
-
-THREE.UTF8Loader.prototype.decompressAttribsInner_ = function ( str, inputStart, inputEnd,
-	output, outputStart, stride, decodeOffset, decodeScale ) {
-
-	var prev = 0;
-
-	for ( var j = inputStart; j < inputEnd; j ++ ) {
-
-		var code = str.charCodeAt( j );
-		prev += ( code >> 1 ) ^ ( - ( code & 1 ) );
-
-		output[ outputStart ] = decodeScale * ( prev + decodeOffset );
-		outputStart += stride;
-
-	}
-
-};
-
-THREE.UTF8Loader.prototype.decompressIndices_ = function ( str, inputStart, numIndices, output, outputStart ) {
-
-	var highest = 0;
-
-	for ( var i = 0; i < numIndices; i ++ ) {
-
-		var code = str.charCodeAt( inputStart ++ );
-
-		output[ outputStart ++ ] = highest - code;
-
-		if ( code === 0 ) {
-
-			highest ++;
-
-		}
-
-	}
-
-};
-
-THREE.UTF8Loader.prototype.decompressAABBs_ = function ( str, inputStart, numBBoxen, decodeOffsets, decodeScales ) {
-
-	var numFloats = 6 * numBBoxen;
-
-	var inputEnd = inputStart + numFloats;
-	var outputStart = 0;
-
-	var bboxen = new Float32Array( numFloats );
-
-	for ( var i = inputStart; i < inputEnd; i += 6 ) {
-
-		var minX = str.charCodeAt( i + 0 ) + decodeOffsets[ 0 ];
-		var minY = str.charCodeAt( i + 1 ) + decodeOffsets[ 1 ];
-		var minZ = str.charCodeAt( i + 2 ) + decodeOffsets[ 2 ];
-
-		var radiusX = ( str.charCodeAt( i + 3 ) + 1 ) >> 1;
-		var radiusY = ( str.charCodeAt( i + 4 ) + 1 ) >> 1;
-		var radiusZ = ( str.charCodeAt( i + 5 ) + 1 ) >> 1;
-
-		bboxen[ outputStart ++ ] = decodeScales[ 0 ] * ( minX + radiusX );
-		bboxen[ outputStart ++ ] = decodeScales[ 1 ] * ( minY + radiusY );
-		bboxen[ outputStart ++ ] = decodeScales[ 2 ] * ( minZ + radiusZ );
-
-		bboxen[ outputStart ++ ] = decodeScales[ 0 ] * radiusX;
-		bboxen[ outputStart ++ ] = decodeScales[ 1 ] * radiusY;
-		bboxen[ outputStart ++ ] = decodeScales[ 2 ] * radiusZ;
-
-	}
-
-	return bboxen;
-
-};
-
-THREE.UTF8Loader.prototype.decompressMesh = function ( str, meshParams, decodeParams, name, idx, callback ) {
-
-	// Extract conversion parameters from attribArrays.
-
-	var stride = decodeParams.decodeScales.length;
-
-	var decodeOffsets = decodeParams.decodeOffsets;
-	var decodeScales = decodeParams.decodeScales;
-
-	var attribStart = meshParams.attribRange[ 0 ];
-	var numVerts = meshParams.attribRange[ 1 ];
-
-	// Decode attributes.
-
-	var inputOffset = attribStart;
-	var attribsOut = new Float32Array( stride * numVerts );
-
-	for ( var j = 0; j < stride; j ++ ) {
-
-		var end = inputOffset + numVerts;
-
-		var decodeScale = decodeScales[ j ];
-
-		if ( decodeScale ) {
-
-			// Assume if decodeScale is never set, simply ignore the
-			// attribute.
-
-			this.decompressAttribsInner_( str, inputOffset, end, attribsOut, j, stride, decodeOffsets[ j ], decodeScale );
-
-		}
-
-		inputOffset = end;
-
-	}
-
-	var numIndices = 3 * meshParams.indexRange[ 1 ];
-
-	var indicesOut = new Uint16Array( numIndices );
-
-	this.decompressIndices_( str, inputOffset, numIndices, indicesOut, 0 );
-
-	// Decode bboxen.
-
-	var bboxen = undefined;
-	var bboxOffset = meshParams.bboxes;
-
-	if ( bboxOffset ) {
-
-		bboxen = this.decompressAABBs_( str, bboxOffset, meshParams.names.length, decodeOffsets, decodeScales );
-
-	}
-
-	callback( name, idx, attribsOut, indicesOut, bboxen, meshParams );
-
-};
-
-THREE.UTF8Loader.prototype.copyAttrib = function ( stride, attribsOutFixed, lastAttrib, index ) {
-
-	for ( var j = 0; j < stride; j ++ ) {
-
-		lastAttrib[ j ] = attribsOutFixed[ stride * index + j ];
-
-	}
-
-};
-
-THREE.UTF8Loader.prototype.decodeAttrib2 = function ( str, stride, decodeOffsets, decodeScales, deltaStart,
-	numVerts, attribsOut, attribsOutFixed, lastAttrib, index ) {
-
-	for ( var j = 0; j < 5; j ++ ) {
-
-		var code = str.charCodeAt( deltaStart + numVerts * j + index );
-		var delta = ( code >> 1 ) ^ ( - ( code & 1 ) );
-
-		lastAttrib[ j ] += delta;
-		attribsOutFixed[ stride * index + j ] = lastAttrib[ j ];
-		attribsOut[ stride * index + j ] = decodeScales[ j ] * ( lastAttrib[ j ] + decodeOffsets[ j ] );
-
-	}
-
-};
-
-THREE.UTF8Loader.prototype.accumulateNormal = function ( i0, i1, i2, attribsOutFixed, crosses ) {
-
-	var p0x = attribsOutFixed[ 8 * i0 ];
-	var p0y = attribsOutFixed[ 8 * i0 + 1 ];
-	var p0z = attribsOutFixed[ 8 * i0 + 2 ];
-
-	var p1x = attribsOutFixed[ 8 * i1 ];
-	var p1y = attribsOutFixed[ 8 * i1 + 1 ];
-	var p1z = attribsOutFixed[ 8 * i1 + 2 ];
-
-	var p2x = attribsOutFixed[ 8 * i2 ];
-	var p2y = attribsOutFixed[ 8 * i2 + 1 ];
-	var p2z = attribsOutFixed[ 8 * i2 + 2 ];
-
-	p1x -= p0x;
-	p1y -= p0y;
-	p1z -= p0z;
-
-	p2x -= p0x;
-	p2y -= p0y;
-	p2z -= p0z;
-
-	p0x = p1y * p2z - p1z * p2y;
-	p0y = p1z * p2x - p1x * p2z;
-	p0z = p1x * p2y - p1y * p2x;
-
-	crosses[ 3 * i0 ] += p0x;
-	crosses[ 3 * i0 + 1 ] += p0y;
-	crosses[ 3 * i0 + 2 ] += p0z;
-
-	crosses[ 3 * i1 ] += p0x;
-	crosses[ 3 * i1 + 1 ] += p0y;
-	crosses[ 3 * i1 + 2 ] += p0z;
-
-	crosses[ 3 * i2 ] += p0x;
-	crosses[ 3 * i2 + 1 ] += p0y;
-	crosses[ 3 * i2 + 2 ] += p0z;
-
-};
-
-THREE.UTF8Loader.prototype.decompressMesh2 = function ( str, meshParams, decodeParams, name, idx, callback ) {
-
-	var MAX_BACKREF = 96;
-
-	// Extract conversion parameters from attribArrays.
-
-	var stride = decodeParams.decodeScales.length;
-
-	var decodeOffsets = decodeParams.decodeOffsets;
-	var decodeScales = decodeParams.decodeScales;
-
-	var deltaStart = meshParams.attribRange[ 0 ];
-	var numVerts = meshParams.attribRange[ 1 ];
-
-	var codeStart = meshParams.codeRange[ 0 ];
-
-	var numIndices = 3 * meshParams.codeRange[ 2 ];
-
-	var indicesOut = new Uint16Array( numIndices );
-
-	var crosses = new Int32Array( 3 * numVerts );
-
-	var lastAttrib = new Uint16Array( stride );
-
-	var attribsOutFixed = new Uint16Array( stride * numVerts );
-	var attribsOut = new Float32Array( stride * numVerts );
-
-	var highest = 0;
-	var outputStart = 0;
-
-	for ( var i = 0; i < numIndices; i += 3 ) {
-
-		var code = str.charCodeAt( codeStart ++ );
-
-		var max_backref = Math.min( i, MAX_BACKREF );
-
-		if ( code < max_backref ) {
-
-  		// Parallelogram
-
-			var winding = code % 3;
-			var backref = i - ( code - winding );
-			var i0, i1, i2;
-
-			switch ( winding ) {
-
-				case 0:
-
-					i0 = indicesOut[ backref + 2 ];
-					i1 = indicesOut[ backref + 1 ];
-					i2 = indicesOut[ backref + 0 ];
-					break;
-
-				case 1:
-
-					i0 = indicesOut[ backref + 0 ];
-					i1 = indicesOut[ backref + 2 ];
-					i2 = indicesOut[ backref + 1 ];
-					break;
-
-				case 2:
-
-					i0 = indicesOut[ backref + 1 ];
-					i1 = indicesOut[ backref + 0 ];
-					i2 = indicesOut[ backref + 2 ];
-					break;
-
-			}
-
-			indicesOut[ outputStart ++ ] = i0;
-			indicesOut[ outputStart ++ ] = i1;
-
-			code = str.charCodeAt( codeStart ++ );
-
-			var index = highest - code;
-			indicesOut[ outputStart ++ ] = index;
-
-			if ( code === 0 ) {
-
-				for ( var j = 0; j < 5; j ++ ) {
-
-					var deltaCode = str.charCodeAt( deltaStart + numVerts * j + highest );
-
-					var prediction = ( ( deltaCode >> 1 ) ^ ( - ( deltaCode & 1 ) ) ) +
-						attribsOutFixed[ stride * i0 + j ] +
-						attribsOutFixed[ stride * i1 + j ] -
-						attribsOutFixed[ stride * i2 + j ];
-
-					lastAttrib[ j ] = prediction;
-
-					attribsOutFixed[ stride * highest + j ] = prediction;
-					attribsOut[ stride * highest + j ] = decodeScales[ j ] * ( prediction + decodeOffsets[ j ] );
-
-				}
-
-				highest ++;
-
-			} else {
-
-				this.copyAttrib( stride, attribsOutFixed, lastAttrib, index );
-
-			}
-
-			this.accumulateNormal( i0, i1, index, attribsOutFixed, crosses );
-
-		} else {
-
-			// Simple
-
-			var index0 = highest - ( code - max_backref );
-
-			indicesOut[ outputStart ++ ] = index0;
-
-			if ( code === max_backref ) {
-
-				this.decodeAttrib2( str, stride, decodeOffsets, decodeScales, deltaStart,
-					numVerts, attribsOut, attribsOutFixed, lastAttrib, highest ++ );
-
-			} else {
-
-				this.copyAttrib( stride, attribsOutFixed, lastAttrib, index0 );
-
-			}
-
-			code = str.charCodeAt( codeStart ++ );
-
-			var index1 = highest - code;
-			indicesOut[ outputStart ++ ] = index1;
-
-			if ( code === 0 ) {
-
-				this.decodeAttrib2( str, stride, decodeOffsets, decodeScales, deltaStart,
-					numVerts, attribsOut, attribsOutFixed, lastAttrib, highest ++ );
-
-			} else {
-
-				this.copyAttrib( stride, attribsOutFixed, lastAttrib, index1 );
-
-			}
-
-			code = str.charCodeAt( codeStart ++ );
-
-			var index2 = highest - code;
-			indicesOut[ outputStart ++ ] = index2;
-
-			if ( code === 0 ) {
-
-				for ( var j = 0; j < 5; j ++ ) {
-
-					lastAttrib[ j ] = ( attribsOutFixed[ stride * index0 + j ] + attribsOutFixed[ stride * index1 + j ] ) / 2;
-
-				}
-
-				this.decodeAttrib2( str, stride, decodeOffsets, decodeScales, deltaStart,
-					numVerts, attribsOut, attribsOutFixed, lastAttrib, highest ++ );
-
-			} else {
-
-				this.copyAttrib( stride, attribsOutFixed, lastAttrib, index2 );
-
-			}
-
-			this.accumulateNormal( index0, index1, index2, attribsOutFixed, crosses );
-
-		}
-
-	}
-
-	for ( var i = 0; i < numVerts; i ++ ) {
-
-		var nx = crosses[ 3 * i ];
-		var ny = crosses[ 3 * i + 1 ];
-		var nz = crosses[ 3 * i + 2 ];
-
-		var norm = 511.0 / Math.sqrt( nx * nx + ny * ny + nz * nz );
-
-		var cx = str.charCodeAt( deltaStart + 5 * numVerts + i );
-		var cy = str.charCodeAt( deltaStart + 6 * numVerts + i );
-		var cz = str.charCodeAt( deltaStart + 7 * numVerts + i );
-
-		attribsOut[ stride * i + 5 ] = norm * nx + ( ( cx >> 1 ) ^ ( - ( cx & 1 ) ) );
-		attribsOut[ stride * i + 6 ] = norm * ny + ( ( cy >> 1 ) ^ ( - ( cy & 1 ) ) );
-		attribsOut[ stride * i + 7 ] = norm * nz + ( ( cz >> 1 ) ^ ( - ( cz & 1 ) ) );
-
-	}
-
-	callback( name, idx, attribsOut, indicesOut, undefined, meshParams );
-
-};
-
-THREE.UTF8Loader.prototype.downloadMesh = function ( path, name, meshEntry, decodeParams, callback ) {
-
-	var loader = this;
-	var idx = 0;
-
-	function onprogress( data ) {
-
-		while ( idx < meshEntry.length ) {
-
-			var meshParams = meshEntry[ idx ];
-			var indexRange = meshParams.indexRange;
-
-			if ( indexRange ) {
-
-				var meshEnd = indexRange[ 0 ] + 3 * indexRange[ 1 ];
-
-				if ( data.length < meshEnd ) break;
-
-				loader.decompressMesh( data, meshParams, decodeParams, name, idx, callback );
-
-			} else {
-
-				var codeRange = meshParams.codeRange;
-				var meshEnd = codeRange[ 0 ] + codeRange[ 1 ];
-
-				if ( data.length < meshEnd ) break;
-
-				loader.decompressMesh2( data, meshParams, decodeParams, name, idx, callback );
-
-			}
-
-			++ idx;
-
-		}
-
-	}
-
-	getHttpRequest( path, function ( data ) {
-
-		onprogress( data );
-
-		// TODO: handle errors.
-
-	} );
-
-};
-
-THREE.UTF8Loader.prototype.downloadMeshes = function ( path, meshUrlMap, decodeParams, callback ) {
-
-	for ( var url in meshUrlMap ) {
-
-		var meshEntry = meshUrlMap[ url ];
-		this.downloadMesh( path + url, url, meshEntry, decodeParams, callback );
-
-	}
-
-};
-
-THREE.UTF8Loader.prototype.createMeshCallback = function ( materialBaseUrl, loadModelInfo, allDoneCallback ) {
-
-	var nCompletedUrls = 0;
-	var nExpectedUrls = 0;
-
-	var expectedMeshesPerUrl = {};
-	var decodedMeshesPerUrl = {};
-
-	var modelParts = {};
-
-	var meshUrlMap = loadModelInfo.urls;
-
-	for ( var url in meshUrlMap ) {
-
-		expectedMeshesPerUrl[ url ] = meshUrlMap[ url ].length;
-		decodedMeshesPerUrl[ url ] = 0;
-
-		nExpectedUrls ++;
-
-		modelParts[ url ] = new THREE.Object3D();
-
-	}
-
-	var model = new THREE.Object3D();
-
-	// Prepare materials first...
-
-	var materialCreator = new THREE.MTLLoader.MaterialCreator( materialBaseUrl, loadModelInfo.options );
-	materialCreator.setMaterials( loadModelInfo.materials );
-
-	materialCreator.preload();
-
-	// Create callback for creating mesh parts
-
-	var bufferGeometryCreator = new THREE.UTF8Loader.BufferGeometryCreator();
-
-	var meshCallback = function ( name, idx, attribArray, indexArray, bboxen, meshParams ) {
-
-		// Got ourselves a new mesh
-
-		// name identifies this part of the model (url)
-		// idx is the mesh index of this mesh of the part
-		// attribArray defines the vertices
-		// indexArray defines the faces
-		// bboxen defines the bounding box
-		// meshParams contains the material info
-
-		var geometry = bufferGeometryCreator.create( attribArray, indexArray );
-		var material = materialCreator.create( meshParams.material );
-
-		var mesh = new THREE.Mesh( geometry, material );
-		modelParts[ name ].add( mesh );
-
-		//model.add(new THREE.Mesh(geometry, material));
-
-		decodedMeshesPerUrl[ name ] ++;
-
-		if ( decodedMeshesPerUrl[ name ] === expectedMeshesPerUrl[ name ] ) {
-
-			nCompletedUrls ++;
-
-			model.add( modelParts[ name ] );
-
-			if ( nCompletedUrls === nExpectedUrls ) {
-
-				// ALL DONE!!!
-
-				allDoneCallback( model );
-
-			}
-
-		}
-
-	};
-
-	return meshCallback;
-
-};
-
-THREE.UTF8Loader.prototype.downloadModel = function ( geometryBase, materialBase, model, callback ) {
-
-	var meshCallback = this.createMeshCallback( materialBase, model, callback );
-	this.downloadMeshes( geometryBase, model.urls, model.decodeParams, meshCallback );
-
-};
-
-THREE.UTF8Loader.prototype.downloadModelJson = function ( jsonUrl, callback, options ) {
-
-	getJsonRequest( jsonUrl, function ( loaded ) {
-
-		if ( ! loaded.decodeParams ) {
-
-			if ( options && options.decodeParams ) {
-
-				loaded.decodeParams = options.decodeParams;
-
-			} else {
-
-				loaded.decodeParams = DEFAULT_DECODE_PARAMS;
-
-			}
-
-		}
-
-		loaded.options = options;
-
-		var geometryBase = jsonUrl.substr( 0, jsonUrl.lastIndexOf( "/" ) + 1 );
-		var materialBase = geometryBase;
-
-		if ( options && options.geometryBase ) {
-
-			geometryBase = options.geometryBase;
-
-			if ( geometryBase.charAt( geometryBase.length - 1 ) !== "/" ) {
-
-				geometryBase = geometryBase + "/";
-
-			}
-
-		}
-
-		if ( options && options.materialBase ) {
-
-			materialBase = options.materialBase;
-
-			if ( materialBase.charAt( materialBase.length - 1 ) !== "/" ) {
-
-				materialBase = materialBase + "/";
-
-			}
-
-		}
-
-		this.downloadModel( geometryBase, materialBase, loaded, callback );
-
-	}.bind( this ) );
-
-};
-
-// XMLHttpRequest stuff
-
-function getHttpRequest( url, onload, opt_onprogress ) {
-
-	var req = new THREE.FileLoader();
-	req.load( url, onload, opt_onprogress );
-
-}
-
-function getJsonRequest( url, onjson ) {
-
-	getHttpRequest( url, function ( e ) {
-
-		onjson( JSON.parse( e ) );
-
-	},
-	function () {} );
-
-}
-
-function addListeners( dom, listeners ) {
-
-	// TODO: handle event capture, object binding.
-
-	for ( var key in listeners ) {
-
-		dom.addEventListener( key, listeners[ key ] );
-
-	}
-
-}

二进制
examples/models/utf8/James_Body_Lores.jpg


二进制
examples/models/utf8/James_EyeLashBotTran.png


二进制
examples/models/utf8/James_EyeLashTopTran.png


二进制
examples/models/utf8/James_Eye_Green.jpg


二进制
examples/models/utf8/James_Eye_Inner_Green.jpg


二进制
examples/models/utf8/James_Face_Color_Hair_Lores.jpg


二进制
examples/models/utf8/James_Mouth_Gum_Lores.jpg


二进制
examples/models/utf8/James_Tongue_Lores.jpg


二进制
examples/models/utf8/MCasShoe1TEX_Lores.jpg


二进制
examples/models/utf8/MJeans1TEX_Lores.jpg


二进制
examples/models/utf8/MTshirt3TEX_Lores.jpg


二进制
examples/models/utf8/Nail_Hand_01_Lores.jpg


+ 0 - 21
examples/models/utf8/WaltHi.js

@@ -1,21 +0,0 @@
-{
-  "materials": {
-    "lambert4sg": { "Kd": [204, 204, 204] }
-  },
-  "decodeParams": {
-    "decodeOffsets": [-5863,24,-6527,0,0,-511,-511,-511],
-    "decodeScales": [0.004800,0.004800,0.004800,0.000978,0.000978,0.001957,0.001957,0.001957]
-  },
-  "urls": {
-    "WaltHi.utf8": [
-      { "material": "lambert4sg",
-        "attribRange": [0, 55294],
-        "codeRange": [442352, 216890, 108427]
-      },
-      { "material": "lambert4sg",
-        "attribRange": [659242, 31285],
-        "codeRange": [909522, 121073, 60507]
-      }
-    ]
-  }
-}

二进制
examples/models/utf8/WaltHi.utf8


+ 0 - 107
examples/models/utf8/ben.js

@@ -1,107 +0,0 @@
-{
-  "materials": {
-    "gums": { "map_Kd": "James_Mouth_Gum_Lores.jpg" },
-    "tongue": { "map_Kd": "James_Tongue_Lores.jpg" },
-    "teethbottom": { "Kd": [251, 248, 248] },
-    "teethtop": { "Kd": [251, 248, 248] },
-    "topeyelashes": { "Kd": [66, 52, 42], "map_Kd": "James_EyeLashTopTran.png", "d": 0.999 },
-    "bottomeyelashes": { "Kd": [66, 52, 42], "map_Kd": "James_EyeLashBotTran.png", "d": 0.999 },
-    "head": { "map_Kd": "James_Face_Color_Hair_Lores.jpg", "Ks": [25,25,25], "Ns": 70 },
-    "eyetrans": { "Kd": [0, 0, 0] },
-    "pupil": { "Kd": [1, 1, 1] },
-    "iris": { "map_Kd": "James_Eye_Inner_Green.jpg" },
-    "eyeball": { "map_Kd": "James_Eye_Green.jpg" },
-    "pants": { "map_Kd": "MJeans1TEX_Lores.jpg", "Ks": [30,30,30], "Ns": 20 },
-    "tshirt3": { "map_Kd": "MTshirt3TEX_Lores.jpg", "Ks": [30,30,30], "Ns": 20 },
-    "skinbody": { "map_Kd": "James_Body_Lores.jpg", "Ks": [25,25,25], "Ns": 70 },
-    "fingernails": { "map_Kd": "Nail_Hand_01_Lores.jpg" },
-    "soleshoe": { "map_Kd": "MCasShoe1TEX_Lores.jpg" },
-    "sole": { "map_Kd": "MCasShoe1TEX_Lores.jpg" },
-    "laces": { "map_Kd": "MCasShoe1TEX_Lores.jpg" },
-    "bow": { "map_Kd": "MCasShoe1TEX_Lores.jpg" }
-  },
-  "decodeParams": {
-    "decodeOffsets": [-2533,-149,-6225,0,0,-511,-511,-511],
-    "decodeScales": [0.000043,0.000043,0.000043,0.000978,0.000978,0.001957,0.001957,0.001957]
-  },
-  "urls": {
-    "ben.utf8": [
-      { "material": "bottomeyelashes",
-        "attribRange": [0, 130],
-        "codeRange": [1040, 388, 192]
-      },
-      { "material": "bow",
-        "attribRange": [1428, 1848],
-        "codeRange": [16212, 6457, 3224]
-      },
-      { "material": "eyeball",
-        "attribRange": [22669, 3834],
-        "codeRange": [53341, 14697, 7284]
-      },
-      { "material": "eyetrans",
-        "attribRange": [68038, 5248],
-        "codeRange": [110022, 20180, 9964]
-      },
-      { "material": "fingernails",
-        "attribRange": [130202, 1023],
-        "codeRange": [138386, 2669, 1228]
-      },
-      { "material": "gums",
-        "attribRange": [141055, 1446],
-        "codeRange": [152623, 5270, 2624]
-      },
-      { "material": "head",
-        "attribRange": [157893, 2219],
-        "codeRange": [175645, 8353, 4168]
-      },
-      { "material": "iris",
-        "attribRange": [183998, 902],
-        "codeRange": [191214, 3332, 1664]
-      },
-      { "material": "laces",
-        "attribRange": [194546, 1016],
-        "codeRange": [202674, 3590, 1792]
-      },
-      { "material": "pants",
-        "attribRange": [206264, 8200],
-        "codeRange": [271864, 30625, 15293]
-      },
-      { "material": "pupil",
-        "attribRange": [302489, 148],
-        "codeRange": [303673, 581, 288]
-      },
-      { "material": "skinbody",
-        "attribRange": [304254, 4990],
-        "codeRange": [344174, 15770, 7830]
-      },
-      { "material": "sole",
-        "attribRange": [359944, 2588],
-        "codeRange": [380648, 9345, 4668]
-      },
-      { "material": "soleshoe",
-        "attribRange": [389993, 3164],
-        "codeRange": [415305, 10721, 5352]
-      },
-      { "material": "teethbottom",
-        "attribRange": [426026, 1235],
-        "codeRange": [435906, 3513, 1656]
-      },
-      { "material": "teethtop",
-        "attribRange": [439419, 1666],
-        "codeRange": [452747, 3937, 1816]
-      },
-      { "material": "tongue",
-        "attribRange": [456684, 845],
-        "codeRange": [463444, 3162, 1578]
-      },
-      { "material": "topeyelashes",
-        "attribRange": [466606, 130],
-        "codeRange": [467646, 388, 192]
-      },
-      { "material": "tshirt3",
-        "attribRange": [468034, 4283],
-        "codeRange": [502298, 14470, 7216]
-      }
-    ]
-  }
-}

二进制
examples/models/utf8/ben.utf8


+ 0 - 107
examples/models/utf8/ben_dds.js

@@ -1,107 +0,0 @@
-{
-  "materials": {
-    "gums": { "map_Kd": "dds/James_Mouth_Gum_Lores.dds" },
-    "tongue": { "map_Kd": "dds/James_Tongue_Lores.dds" },
-    "teethbottom": { "Kd": [251, 248, 248] },
-    "teethtop": { "Kd": [251, 248, 248] },
-    "topeyelashes": { "Kd": [66, 52, 42], "map_Kd": "dds/James_EyeLashTopTran.dds", "d": 0.999 },
-    "bottomeyelashes": { "Kd": [66, 52, 42], "map_Kd": "dds/James_EyeLashBotTran.dds", "d": 0.999 },
-    "head": { "map_Kd": "dds/James_Face_Color_Hair_Lores.dds", "Ks": [25,25,25], "Ns": 70 },
-    "eyetrans": { "Kd": [0, 0, 0] },
-    "pupil": { "Kd": [1, 1, 1] },
-    "iris": { "map_Kd": "dds/James_Eye_Inner_Green.dds" },
-    "eyeball": { "map_Kd": "dds/James_Eye_Green.dds" },
-    "pants": { "map_Kd": "dds/MJeans1TEX_Lores.dds", "Ks": [30,30,30], "Ns": 20 },
-    "tshirt3": { "map_Kd": "dds/MTshirt3TEX_Lores.dds", "Ks": [30,30,30], "Ns": 20 },
-    "skinbody": { "map_Kd": "dds/James_Body_Lores.dds", "Ks": [25,25,25], "Ns": 70 },
-    "fingernails": { "map_Kd": "dds/Nail_Hand_01_Lores.dds" },
-    "soleshoe": { "map_Kd": "dds/MCasShoe1TEX_Lores.dds" },
-    "sole": { "map_Kd": "dds/MCasShoe1TEX_Lores.dds" },
-    "laces": { "map_Kd": "dds/MCasShoe1TEX_Lores.dds" },
-    "bow": { "map_Kd": "dds/MCasShoe1TEX_Lores.dds" }
-  },
-  "decodeParams": {
-    "decodeOffsets": [-2533,-149,-6225,0,0,-511,-511,-511],
-    "decodeScales": [0.000043,0.000043,0.000043,0.000978,0.000978,0.001957,0.001957,0.001957]
-  },
-  "urls": {
-    "ben.utf8": [
-      { "material": "bottomeyelashes",
-        "attribRange": [0, 130],
-        "codeRange": [1040, 388, 192]
-      },
-      { "material": "bow",
-        "attribRange": [1428, 1848],
-        "codeRange": [16212, 6457, 3224]
-      },
-      { "material": "eyeball",
-        "attribRange": [22669, 3834],
-        "codeRange": [53341, 14697, 7284]
-      },
-      { "material": "eyetrans",
-        "attribRange": [68038, 5248],
-        "codeRange": [110022, 20180, 9964]
-      },
-      { "material": "fingernails",
-        "attribRange": [130202, 1023],
-        "codeRange": [138386, 2669, 1228]
-      },
-      { "material": "gums",
-        "attribRange": [141055, 1446],
-        "codeRange": [152623, 5270, 2624]
-      },
-      { "material": "head",
-        "attribRange": [157893, 2219],
-        "codeRange": [175645, 8353, 4168]
-      },
-      { "material": "iris",
-        "attribRange": [183998, 902],
-        "codeRange": [191214, 3332, 1664]
-      },
-      { "material": "laces",
-        "attribRange": [194546, 1016],
-        "codeRange": [202674, 3590, 1792]
-      },
-      { "material": "pants",
-        "attribRange": [206264, 8200],
-        "codeRange": [271864, 30625, 15293]
-      },
-      { "material": "pupil",
-        "attribRange": [302489, 148],
-        "codeRange": [303673, 581, 288]
-      },
-      { "material": "skinbody",
-        "attribRange": [304254, 4990],
-        "codeRange": [344174, 15770, 7830]
-      },
-      { "material": "sole",
-        "attribRange": [359944, 2588],
-        "codeRange": [380648, 9345, 4668]
-      },
-      { "material": "soleshoe",
-        "attribRange": [389993, 3164],
-        "codeRange": [415305, 10721, 5352]
-      },
-      { "material": "teethbottom",
-        "attribRange": [426026, 1235],
-        "codeRange": [435906, 3513, 1656]
-      },
-      { "material": "teethtop",
-        "attribRange": [439419, 1666],
-        "codeRange": [452747, 3937, 1816]
-      },
-      { "material": "tongue",
-        "attribRange": [456684, 845],
-        "codeRange": [463444, 3162, 1578]
-      },
-      { "material": "topeyelashes",
-        "attribRange": [466606, 130],
-        "codeRange": [467646, 388, 192]
-      },
-      { "material": "tshirt3",
-        "attribRange": [468034, 4283],
-        "codeRange": [502298, 14470, 7216]
-      }
-    ]
-  }
-}

二进制
examples/models/utf8/dds/James_Body_Lores.dds


二进制
examples/models/utf8/dds/James_EyeLashBotTran.dds


二进制
examples/models/utf8/dds/James_EyeLashTopTran.dds


二进制
examples/models/utf8/dds/James_Eye_Green.dds


二进制
examples/models/utf8/dds/James_Eye_Inner_Green.dds


二进制
examples/models/utf8/dds/James_Face_Color_Hair_Lores.dds


二进制
examples/models/utf8/dds/James_Mouth_Gum_Lores.dds


二进制
examples/models/utf8/dds/James_Tongue_Lores.dds


二进制
examples/models/utf8/dds/MCasShoe1TEX_Lores.dds


二进制
examples/models/utf8/dds/MJeans1TEX_Lores.dds


二进制
examples/models/utf8/dds/MTshirt3TEX_Lores.dds


二进制
examples/models/utf8/dds/Nail_Hand_01_Lores.dds


二进制
examples/models/utf8/hand.jpg


+ 0 - 27
examples/models/utf8/hand.js

@@ -1,27 +0,0 @@
-{
-  "materials": {
-    "preview": { "Kd": [184, 136, 234] },
-    "nails": { "Kd": [251, 238, 209], "map_Kd": "hand.jpg", "Ks": [30,30,30], "Ns": 100 },
-    "skin": { "Kd": [207, 181, 161],  "map_Kd": "hand.jpg", "Ks": [30,30,30], "Ns": 30 }
-  },
-  "decodeParams": {
-    "decodeOffsets": [-7473,-239,-8362,0,0,-511,-511,-511],
-    "decodeScales": [0.000050,0.000050,0.000050,0.000978,0.000978,0.001957,0.001957,0.001957]
-  },
-  "urls": {
-    "hand.utf8": [
-      { "material": "nails",
-        "attribRange": [0, 261],
-        "codeRange": [2088, 817, 404]
-      },
-      { "material": "preview",
-        "attribRange": [2905, 688],
-        "codeRange": [8409, 2570, 1280]
-      },
-      { "material": "skin",
-        "attribRange": [10979, 8899],
-        "codeRange": [82171, 31026, 15451]
-      }
-    ]
-  }
-}

二进制
examples/models/utf8/hand.utf8


+ 0 - 232
examples/webgl_loader_utf8.html

@@ -1,232 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - loader - UTF8</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<style>
-			body {
-				font-family: Monospace;
-				background-color: #000;
-				color: #fff;
-				margin: 0px;
-				overflow: hidden;
-			}
-			#info {
-				color: #fff;
-				position: absolute;
-				top: 10px;
-				width: 100%;
-				text-align: center;
-				z-index: 100;
-				display:block;
-			}
-			#info a, .button { color: #f00; font-weight: bold; text-decoration: underline; cursor: pointer }
-		</style>
-	</head>
-
-	<body>
-		<div id="info">
-		<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> -
-		<a href="http://code.google.com/p/webgl-loader/" target="_blank" rel="noopener">UTF8 format</a> loader test -
-		models from <a href="http://www.sci.utah.edu/~wald/animrep/" target="_blank" rel="noopener">The Utah 3D Animation Repository</a>
-		</div>
-
-		<script src="../build/three.js"></script>
-
-		<script src="js/loaders/UTF8Loader.js"></script>
-		<script src="js/loaders/MTLLoader.js"></script>
-		<script src="js/loaders/DDSLoader.js"></script>
-
-		<script src="js/Detector.js"></script>
-		<script src="js/libs/stats.min.js"></script>
-
-		<script>
-
-			var SCREEN_WIDTH = window.innerWidth;
-			var SCREEN_HEIGHT = window.innerHeight;
-
-			var FLOOR = -150;
-
-			var container, stats;
-
-			var camera, scene, renderer;
-
-			var mesh, zmesh, geometry;
-
-			var mouseX = 0, mouseY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			document.addEventListener('mousemove', onDocumentMouseMove, false);
-
-			init();
-			animate();
-
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				camera = new THREE.PerspectiveCamera( 20, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 2000 );
-				camera.position.z = 800;
-
-				scene = new THREE.Scene();
-				scene.background = new THREE.Color( 0x000000 );
-				scene.fog = new THREE.Fog( 0x000000, 800, 2000 );
-
-				var path = "textures/cube/SwedishRoyalCastle/";
-				var format = '.jpg';
-				var urls = [
-					path + 'px' + format, path + 'nx' + format,
-					path + 'py' + format, path + 'ny' + format,
-					path + 'pz' + format, path + 'nz' + format
-				];
-
-				reflectionCube = new THREE.CubeTextureLoader().load( urls );
-
-				// LIGHTS
-
-				var ambient = new THREE.AmbientLight( 0x222222 );
-				scene.add( ambient );
-
-				var directionalLight = new THREE.DirectionalLight( 0xffffff, 1.1 );
-				directionalLight.position.set( 0, 20, 300 );
-				scene.add( directionalLight );
-
-				directionalLight.castShadow = true;
-
-				directionalLight.shadow.mapSize.width = 2048;
-				directionalLight.shadow.mapSize.height = 2048;
-
-				var d = 150;
-
-				directionalLight.shadow.camera.left = -d * 1.2;
-				directionalLight.shadow.camera.right = d * 1.2;
-				directionalLight.shadow.camera.top = d;
-				directionalLight.shadow.camera.bottom = -d;
-
-				directionalLight.shadow.camera.near = 200;
-				directionalLight.shadow.camera.far = 500;
-
-
-				// RENDERER
-
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
-				renderer.domElement.style.position = "relative";
-				container.appendChild( renderer.domElement );
-
-				//
-
-				renderer.gammaInput = true;
-				renderer.gammaOutput = true;
-
-				renderer.shadowMap.enabled = true;
-				renderer.shadowMap.type = THREE.PCFShadowMap;
-
-				// STATS
-
-				stats = new Stats();
-				container.appendChild( stats.dom );
-
-				var start = Date.now();
-
-				THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
-
-				var loader = new THREE.UTF8Loader();
-
-				loader.load( "models/utf8/hand.js", function ( object ) {
-
-					var end = Date.now();
-					console.log( "hand", end - start, "ms" );
-
-					var s = 350;
-					object.scale.set( s, s, s );
-					object.position.x = 125;
-					object.position.y = -125;
-					scene.add( object );
-
-					object.traverse( function( node ) {
-
-						node.castShadow = true;
-						node.receiveShadow = true;
-
-					} );
-
-				}, { normalizeRGB: true } );
-
-				loader.load( "models/utf8/ben_dds.js", function ( object ) {
-
-					var end = Date.now();
-					console.log( "ben", end - start, "ms" );
-
-					var s = 350;
-					object.scale.set( s, s, s );
-					object.position.x = -125;
-					object.position.y = -125;
-					scene.add( object );
-
-					object.traverse( function( node ) {
-
-						node.castShadow = true;
-						node.receiveShadow = true;
-
-					} );
-
-				}, { normalizeRGB: true } );
-
-				//
-
-				window.addEventListener( 'resize', onWindowResize, false );
-
-			}
-
-			function onWindowResize() {
-
-				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-			}
-
-			function onDocumentMouseMove( event ) {
-
-				mouseX = ( event.clientX - windowHalfX );
-				mouseY = ( event.clientY - windowHalfY );
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-				stats.update();
-
-			}
-
-			function render() {
-
-				camera.position.x += ( mouseX - camera.position.x ) * .05;
-				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-
-				camera.lookAt( scene.position );
-
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-	</body>
-</html>