diff --git a/build/three.js b/build/three.js index 44516f12d012ec0783f3189ecb31388bb083a33f..1a2addeea1c4fdca19a81f3c569c02953ee0a2a8 100644 --- a/build/three.js +++ b/build/three.js @@ -14275,6 +14275,25 @@ THREE.CompressedTexture.prototype.clone = function () { }; +/** + * @author Daosheng Mu / https://github.com/DaoshengMu/ + */ + +THREE.TGATexture = function ( format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) { + + THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); +}; + +THREE.TGATexture.prototype = Object.create( THREE.Texture.prototype ); + +THREE.TGATexture.prototype.clone = function() { + + var texture = new THREE.TGATexture(); + + THREE.Texture.prototype.clone.all( this. texture ); + + return texture; +}; /** * @author alteredq / http://alteredqualia.com/ */ @@ -25157,7 +25176,11 @@ THREE.WebGLRenderer = function ( parameters ) { } - } else { // regular Texture (image, video, canvas) + } else if ( texture instanceof THREE.TGATexture ) { + var tgaImg = texture.image; + _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, tgaImg.width, tgaImg.height, 0, glFormat, glType, tgaImg.data ); + + } else { // regular Texture (image, video, canvas) // use manually created mipmaps if available // if there are no manual mipmaps @@ -26660,6 +26683,7 @@ THREE.GeometryUtils = { /** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ + * @author Daosheng Mu / https://github.com/DaoshengMu/ */ THREE.ImageUtils = { @@ -26889,6 +26913,453 @@ THREE.ImageUtils = { return texture; }, + + + // reference from vthibault, https://github.com/vthibault/roBrowser/blob/master/src/Loaders/Targa.js + decodeTGA: function ( arrayBuffer ) { + + // TGA Constants + var TGA_TYPE_NO_DATA = 0, + TGA_TYPE_INDEXED = 1, + TGA_TYPE_RGB = 2, + TGA_TYPE_GREY = 3, + TGA_TYPE_RLE_INDEXED = 9, + TGA_TYPE_RLE_RGB = 10, + TGA_TYPE_RLE_GREY = 11, + + TGA_ORIGIN_MASK = 0x30, + TGA_ORIGIN_SHIFT = 0x04, + TGA_ORIGIN_BL = 0x00, + TGA_ORIGIN_BR = 0x01, + TGA_ORIGIN_UL = 0x02, + TGA_ORIGIN_UR = 0x03; + + + if ( arrayBuffer.length < 19 ) + console.error( 'ImageUtils::decodeTGA()- Not enough data to contain header.' ); + + var content = new Uint8Array( arrayBuffer ), + offset = 0, + header = { + id_length: content[ offset++ ], + colormap_type: content[ offset++ ], + image_type: content[offset++], + colormap_index: content[offset++] | content[offset++] << 8, + colormap_length: content[offset++] | content[offset++] << 8, + colormap_size: content[offset++], + + origin: [ + content[offset++] | content[offset++] << 8, + content[offset++] | content[offset++] << 8 + ], + width: content[offset++] | content[offset++] << 8, + height: content[offset++] | content[offset++] << 8, + pixel_size: content[offset++], + flags: content[offset++] + }; + + function tgaCheckHeader( header ) { + switch( header.image_type ) { + // Check indexed type + case TGA_TYPE_INDEXED: + case TGA_TYPE_RLE_INDEXED: + if ( header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1) { + console.error('Targa::tgaCheckHeader() - Invalid type colormap data for indexed type'); + } + break; + + // Check colormap type + case TGA_TYPE_RGB: + case TGA_TYPE_GREY: + case TGA_TYPE_RLE_RGB: + case TGA_TYPE_RLE_GREY: + if (header.colormap_type) { + console.error('ImageUtils::tgaCheckHeader() - Invalid type colormap data for colormap type'); + } + break; + + // What the need of a file without data ? + case TGA_TYPE_NO_DATA: + console.error('ImageUtils::tgaCheckHeader() - No data'); + + // Invalid type ? + default: + console.error('ImageUtils::tgaCheckHeader() - Invalid type " '+ header.image_type + '"'); + } + + // Check image width and height + if ( header.width <= 0 || header.height <=0 ) { + console.error( 'ImageUtils::tgaCheckHeader() - Invalid image size' ); + } + + // Check image pixel size + if (header.pixel_size !== 8 && + header.pixel_size !== 16 && + header.pixel_size !== 24 && + header.pixel_size !== 32) { + console.error('ImageUtils::tgaCheckHeader() - Invalid pixel size "' + header.pixel_size + '"'); + } + } + + // Check tga if it is valid format + tgaCheckHeader( header ); + + if ( header.id_length + offset > arrayBuffer.length ) { + console.error('ImageUtils::load() - No data'); + } + + // Skip the needn't data + offset += header.id_length; + + // Get targa information about RLE compression and palette + var use_rle = false, + use_pal = false, + use_grey = false; + + switch ( header.image_type ) { + case TGA_TYPE_RLE_INDEXED: + use_rle = true; + use_pal = true; + break; + + case TGA_TYPE_INDEXED: + use_pal = true; + break; + + case TGA_TYPE_RLE_RGB: + use_rle = true; + break; + + case TGA_TYPE_RGB: + break; + + case TGA_TYPE_RLE_GREY: + use_rle = true; + use_grey = true; + break; + + case TGA_TYPE_GREY: + use_grey = true; + break; + } + + // Parse tga image buffer + function tgaParse( use_rle, use_pal, header, offset, data ) { + + var pixel_data, + pixel_size, + pixel_total, + palettes; + + pixel_size = header.pixel_size >> 3; + pixel_total = header.width * header.height * pixel_size; + + // Read palettes + if ( use_pal ) { + palettes = data.subarray( offset, offset += header.colormap_length * 3 ); + } + + // Read RLE + if ( use_rle ) { + pixel_data = new Uint8Array(pixel_total); + + var c, count, i; + var shift = 0; + var pixels = new Uint8Array(pixel_size); + + while (shift < pixel_total) { + c = data[offset++]; + count = (c & 0x7f) + 1; + + // RLE pixels. + if (c & 0x80) { + // Bind pixel tmp array + for (i = 0; i < pixel_size; ++i) { + pixels[i] = data[offset++]; + } + + // Copy pixel array + for (i = 0; i < count; ++i) { + pixel_data.set(pixels, shift + i * pixel_size); + } + + shift += pixel_size * count; + } + + // Raw pixels. + else { + count *= pixel_size; + for (i = 0; i < count; ++i) { + pixel_data[shift + i] = data[offset++]; + } + shift += count; + } + } + } + // RAW Pixels + else { + pixel_data = data.subarray( + offset, offset += (use_pal ? header.width * header.height : pixel_total) + ); + } + + return { + pixel_data: pixel_data, + palettes: palettes + }; + } + + function tgaGetImageData8bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end + , image, palettes ) { + var colormap = palettes; + var color, i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i++) { + color = image[i]; + imageData[(x + width * y) * 4 + 3] = 255; + imageData[(x + width * y) * 4 + 2] = colormap[(color * 3) + 0]; + imageData[(x + width * y) * 4 + 1] = colormap[(color * 3) + 1]; + imageData[(x + width * y) * 4 + 0] = colormap[(color * 3) + 2]; + } + } + + return imageData; + }; + + function tgaGetImageData16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end + , image) { + var color, i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 2) { + color = image[i + 0] + (image[i + 1] << 8); // Inversed ? + imageData[(x + width * y) * 4 + 0] = (color & 0x7C00) >> 7; + imageData[(x + width * y) * 4 + 1] = (color & 0x03E0) >> 2; + imageData[(x + width * y) * 4 + 2] = (color & 0x001F) >> 3; + imageData[(x + width * y) * 4 + 3] = (color & 0x8000) ? 0 : 255; + } + } + + return imageData; + }; + + function tgaGetImageData24bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) { + var i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 3) { + imageData[(x + width * y) * 4 + 3] = 255; + imageData[(x + width * y) * 4 + 2] = image[i + 0]; + imageData[(x + width * y) * 4 + 1] = image[i + 1]; + imageData[(x + width * y) * 4 + 0] = image[i + 2]; + } + } + + return imageData; + }; + + function tgaGetImageData32bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) { + var i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 4) { + imageData[(x + width * y) * 4 + 2] = image[i + 0]; + imageData[(x + width * y) * 4 + 1] = image[i + 1]; + imageData[(x + width * y) * 4 + 0] = image[i + 2]; + imageData[(x + width * y) * 4 + 3] = image[i + 3]; + } + } + + return imageData; + }; + + function tgaGetImageDataGrey8bits( imageData, y_start, y_step, y_end, x_start, x_step, x_end, image ) { + var color, i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i++) { + color = image[i]; + imageData[(x + width * y) * 4 + 0] = color; + imageData[(x + width * y) * 4 + 1] = color; + imageData[(x + width * y) * 4 + 2] = color; + imageData[(x + width * y) * 4 + 3] = 255; + } + } + + return imageData; + }; + + function tgaGetImageDataGrey16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) { + var i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 2) { + imageData[(x + width * y) * 4 + 0] = image[i + 0]; + imageData[(x + width * y) * 4 + 1] = image[i + 0]; + imageData[(x + width * y) * 4 + 2] = image[i + 0]; + imageData[(x + width * y) * 4 + 3] = image[i + 1]; + } + } + + return imageData; + }; + + function getTgaRGBA( width, height, image, palette ) { + var x_start, + y_start, + x_step, + y_step, + x_end, + y_end, + data = new Uint8Array(width * height * 4); + + switch( (header.flags & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT ) { + default: + case TGA_ORIGIN_UL: + x_start = 0; + x_step = 1; + x_end = width; + y_start = 0; + y_step = 1; + y_end = height; + break; + + case TGA_ORIGIN_BL: + x_start = 0; + x_step = 1; + x_end = width; + y_start = height - 1; + y_step = -1; + y_end = -1; + break; + + case TGA_ORIGIN_UR: + x_start = width - 1; + x_step = -1; + x_end = -1; + y_start = 0; + y_step = 1; + y_end = height; + break; + + case TGA_ORIGIN_BR: + x_start = width - 1; + x_step = -1; + x_end = -1; + y_start = height - 1; + y_step = -1; + y_end = -1; + break; + } + + + if ( use_grey ) { + + switch( header.pixel_size ) + { + case 8: + tgaGetImageDataGrey8bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + case 16: + tgaGetImageDataGrey16bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + default: + console.error( 'ImageUtils::getTgaRGBA() - not support this format' ); + break; + } + + } + else { + + switch( header.pixel_size ) + { + case 8: + tgaGetImageData8bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image, palette ); + break; + + case 16: + tgaGetImageData16bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + + case 24: + tgaGetImageData24bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + + case 32: + tgaGetImageData32bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + + default: + console.error( 'ImageUtils::getTgaRGBA() - not support this format' ); + break; + } + } + // Load image data according to specific method + // var func = 'tgaGetImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits'; + //func(data, y_start, y_step, y_end, x_start, x_step, x_end, width, image, palette ); + return data; + } + + var result = tgaParse( use_rle, use_pal, header, offset, content ); + var rgbaData = getTgaRGBA( header.width, header.height, result.pixel_data, result.palettes ); + + + return { + width: header.width, + height: header.height, + data: rgbaData + }; + }, + + loadTGATexture: function ( url, mapping, onLoad, onError ) { + + var texture = new THREE.TGATexture(); + { + var request = new XMLHttpRequest(); + + request.open( 'GET', url, true ); + request.responseType = "arraybuffer"; + request.onload = function() { + if ( this.status === 200 ) { + var imageData = THREE.ImageUtils.decodeTGA( this.response ); + + if ( imageData ) { + texture.image = imageData; + texture.sourceFile = url; + texture.needsUpdate = true; + + return texture; + } + + } + }; + + request.addEventListener( 'load', function ( event ) { + + if ( onLoad ) onLoad( texture ); + + }, false ); + + request.addEventListener( 'error', function ( event ) { + + if ( onError ) onError( event ); + + }, false ); + + request.send(null); + } + + texture.sourceFile = url; + + return texture; + }, loadDDSTexture: function ( url, mapping, onLoad, onError ) { diff --git a/build/three.min.js b/build/three.min.js index 259e74648444a70bf0a6e9b0c5557cd5c40ea0c3..23cd6375979706ad80f42629e023726c73804055 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -62,9 +62,9 @@ Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return t setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp: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;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z, this.w)}};THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ"; THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this},copy:function(a){this._x= -a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b){var c=THREE.Math.clamp,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],k=d[5],l=d[9],p=d[2],q=d[6],d=d[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(g,-1,1)),0.99999>Math.abs(g)?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-f,e)):(this._x=Math.atan2(q,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(l,-1,1)),0.99999>Math.abs(l)?(this._y=Math.atan2(g,d),this._z=Math.atan2(h,k)): -(this._y=Math.atan2(-p,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(q,-1,1)),0.99999>Math.abs(q)?(this._y=Math.atan2(-p,d),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,e))):"ZYX"===b?(this._y=Math.asin(-c(p,-1,1)),0.99999>Math.abs(p)?(this._x=Math.atan2(q,d),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(c(h,-1,1)),0.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-p,e)):(this._x=0,this._y=Math.atan2(g,d))):"XZY"===b?(this._z= -Math.asin(-c(f,-1,1)),0.99999>Math.abs(f)?(this._x=Math.atan2(q,k),this._y=Math.atan2(g,e)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this._order=b;this.onChangeCallback();return this},setFromQuaternion:function(a,b,c){var d=THREE.Math.clamp,e=a.x*a.x,f=a.y*a.y,g=a.z*a.z,h=a.w*a.w;b=b||this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-e-f+g),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w),-1,1)),this._z=Math.atan2(2* +a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b){var c=THREE.Math.clamp,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],k=d[5],l=d[9],p=d[2],s=d[6],d=d[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(g,-1,1)),0.99999>Math.abs(g)?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-f,e)):(this._x=Math.atan2(s,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(l,-1,1)),0.99999>Math.abs(l)?(this._y=Math.atan2(g,d),this._z=Math.atan2(h,k)): +(this._y=Math.atan2(-p,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(s,-1,1)),0.99999>Math.abs(s)?(this._y=Math.atan2(-p,d),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,e))):"ZYX"===b?(this._y=Math.asin(-c(p,-1,1)),0.99999>Math.abs(p)?(this._x=Math.atan2(s,d),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(c(h,-1,1)),0.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-p,e)):(this._x=0,this._y=Math.atan2(g,d))):"XZY"===b?(this._z= +Math.asin(-c(f,-1,1)),0.99999>Math.abs(f)?(this._x=Math.atan2(s,k),this._y=Math.atan2(g,e)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this._order=b;this.onChangeCallback();return this},setFromQuaternion:function(a,b,c){var d=THREE.Math.clamp,e=a.x*a.x,f=a.y*a.y,g=a.z*a.z,h=a.w*a.w;b=b||this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-e-f+g),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w),-1,1)),this._z=Math.atan2(2* (a.z*a.w-a.x*a.y),h+e-f-g)):"YXZ"===b?(this._x=Math.asin(d(2*(a.x*a.w-a.y*a.z),-1,1)),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h-e-f+g),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-e+f-g)):"ZXY"===b?(this._x=Math.asin(d(2*(a.x*a.w+a.y*a.z),-1,1)),this._y=Math.atan2(2*(a.y*a.w-a.z*a.x),h-e-f+g),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-e+f-g)):"ZYX"===b?(this._x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-e-f+g),this._y=Math.asin(d(2*(a.y*a.w-a.x*a.z),-1,1)),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h+e-f-g)):"YZX"=== b?(this._x=Math.atan2(2*(a.x*a.w-a.z*a.y),h-e+f-g),this._y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+e-f-g),this._z=Math.asin(d(2*(a.x*a.y+a.z*a.w),-1,1))):"XZY"===b?(this._x=Math.atan2(2*(a.x*a.w+a.y*a.z),h-e+f-g),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+e-f-g),this._z=Math.asin(d(2*(a.z*a.w-a.x*a.y),-1,1))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this); this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(){return[this._x,this._y,this._z,this._order]},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; @@ -89,22 +89,22 @@ multiplyVector3Array:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVe a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7],a=a[8];return b*f*a-b*g*k-c*e*a+c*g*h+d*e*k-d*f*h},getInverse:function(a,b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]- c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3]; a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0], -a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,k,l,p,q,r,s,t,n){var v=this.elements=new Float32Array(16);v[0]=void 0!==a?a:1;v[4]=b||0;v[8]=c||0;v[12]=d||0;v[1]=e||0;v[5]=void 0!==f?f:1;v[9]=g||0;v[13]=h||0;v[2]=k||0;v[6]=l||0;v[10]=void 0!==p?p:1;v[14]=q||0;v[3]=r||0;v[7]=s||0;v[11]=t||0;v[15]=void 0!==n?n:1}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,p,q,r,s,t,n){var v=this.elements;v[0]=a;v[4]=b;v[8]=c;v[12]=d;v[1]=e;v[5]=f;v[9]=g;v[13]=h;v[2]=k;v[6]=l;v[10]=p;v[14]=q;v[3]=r;v[7]=s;v[11]=t;v[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition()."); +a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,k,l,p,s,r,u,q,n){var t=this.elements=new Float32Array(16);t[0]=void 0!==a?a:1;t[4]=b||0;t[8]=c||0;t[12]=d||0;t[1]=e||0;t[5]=void 0!==f?f:1;t[9]=g||0;t[13]=h||0;t[2]=k||0;t[6]=l||0;t[10]=void 0!==p?p:1;t[14]=s||0;t[3]=r||0;t[7]=u||0;t[11]=q||0;t[15]=void 0!==n?n:1}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,p,s,r,u,q,n){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=e;t[5]=f;t[9]=g;t[13]=h;t[2]=k;t[6]=l;t[10]=p;t[14]=s;t[3]=r;t[7]=u;t[11]=q;t[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition()."); return this.copyPosition(a)},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements;b=b.elements;var d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){!1=== a instanceof THREE.Euler&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,l=c*h,p=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+l*d;b[5]=a-p*d;b[9]=-c*g;b[2]=p-a*d;b[6]=l+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a+p*c,b[4]=l*c-k,b[8]= f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=p+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=l+k*c,b[1]=k+l*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,l=c*h,p=c*e,b[0]=g*h,b[4]=l*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,l=c*g,p=c*d,b[0]=g*h,b[4]=p-a*e,b[8]=l*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,l=c*g,p=c*d,b[0]= g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=p*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var l=c* h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]= -a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],l=c[1],p=c[5],q=c[9],r=c[13],s=c[2],t=c[6],n=c[10],v=c[14],w=c[3],u=c[7],x=c[11], -c=c[15],F=d[0],C=d[4],D=d[8],z=d[12],G=d[1],I=d[5],B=d[9],y=d[13],A=d[2],O=d[6],L=d[10],M=d[14],K=d[3],H=d[7],Q=d[11],d=d[15];e[0]=f*F+g*G+h*A+k*K;e[4]=f*C+g*I+h*O+k*H;e[8]=f*D+g*B+h*L+k*Q;e[12]=f*z+g*y+h*M+k*d;e[1]=l*F+p*G+q*A+r*K;e[5]=l*C+p*I+q*O+r*H;e[9]=l*D+p*B+q*L+r*Q;e[13]=l*z+p*y+q*M+r*d;e[2]=s*F+t*G+n*A+v*K;e[6]=s*C+t*I+n*O+v*H;e[10]=s*D+t*B+n*L+v*Q;e[14]=s*z+t*y+n*M+v*d;e[3]=w*F+u*G+x*A+c*K;e[7]=w*C+u*I+x*O+c*H;e[11]=w*D+u*B+x*L+c*Q;e[15]=w*z+u*y+x*M+c*d;return this},multiplyToArray:function(a, +a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],l=c[1],p=c[5],s=c[9],r=c[13],u=c[2],q=c[6],n=c[10],t=c[14],w=c[3],v=c[7],x=c[11], +c=c[15],F=d[0],C=d[4],D=d[8],z=d[12],G=d[1],I=d[5],B=d[9],y=d[13],A=d[2],O=d[6],L=d[10],M=d[14],K=d[3],H=d[7],Q=d[11],d=d[15];e[0]=f*F+g*G+h*A+k*K;e[4]=f*C+g*I+h*O+k*H;e[8]=f*D+g*B+h*L+k*Q;e[12]=f*z+g*y+h*M+k*d;e[1]=l*F+p*G+s*A+r*K;e[5]=l*C+p*I+s*O+r*H;e[9]=l*D+p*B+s*L+r*Q;e[13]=l*z+p*y+s*M+r*d;e[2]=u*F+q*G+n*A+t*K;e[6]=u*C+q*I+n*O+t*H;e[10]=u*D+q*B+n*L+t*Q;e[14]=u*z+q*y+n*M+t*d;e[3]=w*F+v*G+x*A+c*K;e[7]=w*C+v*I+x*O+c*H;e[11]=w*D+v*B+x*L+c*Q;e[15]=w*z+v*y+x*M+c*d;return this},multiplyToArray:function(a, b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."); return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0); void 0===d&&(d=b.length);for(var e=0;ed?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(0.5),f=b.clone().sub(a).normalize(),g=0.5*a.distanceTo(b), -h=this.origin.clone().sub(e);a=-this.direction.dot(f);b=h.dot(this.direction);var k=-h.dot(f),l=h.lengthSq(),p=Math.abs(1-a*a),q,r;0<=p?(h=a*k-b,q=a*b-k,r=g*p,0<=h?q>=-r?q<=r?(g=1/p,h*=g,q*=g,a=h*(h+a*q+2*b)+q*(a*h+q+2*k)+l):(q=g,h=Math.max(0,-(a*q+b)),a=-h*h+q*(q+2*k)+l):(q=-g,h=Math.max(0,-(a*q+b)),a=-h*h+q*(q+2*k)+l):q<=-r?(h=Math.max(0,-(-a*g+b)),q=0a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)? +h=this.origin.clone().sub(e);a=-this.direction.dot(f);b=h.dot(this.direction);var k=-h.dot(f),l=h.lengthSq(),p=Math.abs(1-a*a),s,r;0<=p?(h=a*k-b,s=a*b-k,r=g*p,0<=h?s>=-r?s<=r?(g=1/p,h*=g,s*=g,a=h*(h+a*s+2*b)+s*(a*h+s+2*k)+l):(s=g,h=Math.max(0,-(a*s+b)),a=-h*h+s*(s+2*k)+l):(s=-g,h=Math.max(0,-(a*s+b)),a=-h*h+s*(s+2*k)+l):s<=-r?(h=Math.max(0,-(-a*g+b)),s=0a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)? 0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new THREE.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*= a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(fg||e>d)return null;if(e>c||c!==c)c=e;if(gd?null:this.at(0<=c?c:d,b)},intersectTriangle:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0< f){if(h)return null;h=1}else if(0>f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}, @@ -123,8 +123,8 @@ clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){t THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,g=b.length;f=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<= this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius); return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]}; -THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],p=c[8],q=c[9],r=c[10],s=c[11],t=c[12],n=c[13],v=c[14],c=c[15];b[0].setComponents(f-a,l-g,s-p,c-t).normalize();b[1].setComponents(f+ -a,l+g,s+p,c+t).normalize();b[2].setComponents(f+d,l+h,s+q,c+n).normalize();b[3].setComponents(f-d,l-h,s-q,c-n).normalize();b[4].setComponents(f-e,l-k,s-r,c-v).normalize();b[5].setComponents(f+e,l+k,s+r,c+v).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, +THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],p=c[8],s=c[9],r=c[10],u=c[11],q=c[12],n=c[13],t=c[14],c=c[15];b[0].setComponents(f-a,l-g,u-p,c-q).normalize();b[1].setComponents(f+ +a,l+g,u+p,c+q).normalize();b[2].setComponents(f+d,l+h,u+s,c+n).normalize();b[3].setComponents(f-d,l-h,u-s,c-n).normalize();b[4].setComponents(f-e,l-k,u-r,c-t).normalize();b[5].setComponents(f+e,l+k,u+r,c+t).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0g&&0>f)return!1}return!0}}(), containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d, @@ -133,8 +133,8 @@ b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal). coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Matrix3;return function(d,e){var f=e||c.getNormalMatrix(d),f=a.copy(this.normal).applyMatrix3(f),g=this.coplanarPoint(b);g.applyMatrix4(d);this.setFromNormalAndCoplanarPoint(f,g);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&& a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Math={generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function(){for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1: -f+2;l=this.points[c[0]];p=this.points[c[1]];q=this.points[c[2]];r=this.points[c[3]];h=g*g;k=g*h;d.x=b(l.x,p.x,q.x,r.x,g,h,k);d.y=b(l.y,p.y,q.y,r.y,g,h,k);d.z=b(l.z,p.z,q.z,r.z,g,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;athis.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1: +f+2;l=this.points[c[0]];p=this.points[c[1]];s=this.points[c[2]];r=this.points[c[3]];h=g*g;k=g*h;d.x=b(l.x,p.x,s.x,r.x,g,h,k);d.y=b(l.y,p.y,s.y,r.y,g,h,k);d.z=b(l.z,p.z,s.z,r.z,g,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;af.scale.x)return s;s.push({distance:t,point:f.position,face:null,object:f})}else if(f instanceof -a.PointCloud)for(var n=f.geometry.vertices,v=0;vt&&s.push({distance:t,index:v,face:null,object:f});else if(f instanceof a.LOD)d.setFromMatrixPosition(f.matrixWorld),t=p.ray.origin.distanceTo(d),l(f.getObjectForDistance(t),p,s);else if(f instanceof a.Mesh){v=f.geometry;null===v.boundingSphere&&v.computeBoundingSphere();b.copy(v.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return s; -e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e);if(null!==v.boundingBox&&!1===c.isIntersectionBox(v.boundingBox))return s;if(v instanceof a.BufferGeometry){var w=f.material;if(void 0===w)return s;var u=v.attributes,x,F,C=p.precision;if(void 0!==u.index){var n=u.index.array,D=u.position.array,z=v.offsets;0===z.length&&(z=[{start:0,count:D.length,index:0}]);for(var G=0,I=z.length;Gp.far||s.push({distance:t,point:A,indices:[u,x,F],face:null,faceIndex:null,object:f}))}}}else for(D=u.position.array,v=0,y=u.position.array.length;vp.far||s.push({distance:t,point:A,indices:[u,x,F],face:null,faceIndex:null,object:f}))}else if(v instanceof a.Geometry)for(D=f.material instanceof a.MeshFaceMaterial,z=!0===D?f.material.materials:null,C=p.precision,n=v.vertices,G=0,I=v.faces.length;Gp.far||s.push({distance:t,point:A,face:B,faceIndex:G,object:f}))}}else if(f instanceof a.Line){C=p.linePrecision;w=C*C;v=f.geometry;null===v.boundingSphere&&v.computeBoundingSphere();b.copy(v.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e); -if(v instanceof a.Geometry)for(n=v.vertices,C=n.length,u=new a.Vector3,x=new a.Vector3,F=f.type===a.LineStrip?1:2,v=0;vw||(t=c.origin.distanceTo(x),tp.far||s.push({distance:t,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},p=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;df.scale.x)return u;u.push({distance:q,point:f.position,face:null,object:f})}else if(f instanceof +a.PointCloud)for(var n=f.geometry.vertices,t=0;tq&&u.push({distance:q,index:t,face:null,object:f});else if(f instanceof a.LOD)d.setFromMatrixPosition(f.matrixWorld),q=p.ray.origin.distanceTo(d),l(f.getObjectForDistance(q),p,u);else if(f instanceof a.Mesh){t=f.geometry;null===t.boundingSphere&&t.computeBoundingSphere();b.copy(t.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return u; +e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e);if(null!==t.boundingBox&&!1===c.isIntersectionBox(t.boundingBox))return u;if(t instanceof a.BufferGeometry){var w=f.material;if(void 0===w)return u;var v=t.attributes,x,F,C=p.precision;if(void 0!==v.index){var n=v.index.array,D=v.position.array,z=t.offsets;0===z.length&&(z=[{start:0,count:D.length,index:0}]);for(var G=0,I=z.length;Gp.far||u.push({distance:q,point:A,indices:[v,x,F],face:null,faceIndex:null,object:f}))}}}else for(D=v.position.array,t=0,y=v.position.array.length;tp.far||u.push({distance:q,point:A,indices:[v,x,F],face:null,faceIndex:null,object:f}))}else if(t instanceof a.Geometry)for(D=f.material instanceof a.MeshFaceMaterial,z=!0===D?f.material.materials:null,C=p.precision,n=t.vertices,G=0,I=t.faces.length;Gp.far||u.push({distance:q,point:A,face:B,faceIndex:G,object:f}))}}else if(f instanceof a.Line){C=p.linePrecision;w=C*C;t=f.geometry;null===t.boundingSphere&&t.computeBoundingSphere();b.copy(t.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e); +if(t instanceof a.Geometry)for(n=t.vertices,C=n.length,v=new a.Vector3,x=new a.Vector3,F=f.type===a.LineStrip?1:2,t=0;tw||(q=c.origin.distanceTo(x),qp.far||u.push({distance:q,point:v.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},p=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;de&&0>f||0>g&& -0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(de&&0>f||0>g&& +0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},p=function(a,b,c){if(!0===a.visible||!0===b.visible||!0===c.visible)return!0;H[0]=a.positionScreen; H[1]=b.positionScreen;H[2]=c.positionScreen;return M.isIntersectionBox(K.setFromPoints(H))},r=function(a,b,c){return 0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x)};return{setObject:function(a){f=a;g=f.material;h.getNormalMatrix(f.matrixWorld);d.length=0;e.length=0},projectVertex:k,checkTriangleVisibility:p,checkBackfaceCulling:r,pushVertex:function(b,c,d){l=a();l.position.set(b,c,d); -k(l)},pushNormal:function(a,b,c){d.push(a,b,c)},pushUv:function(a,b){e.push(a,b)},pushLine:function(a,b){var d=q[a],e=q[b];w=c();w.id=f.id;w.v1.copy(d);w.v2.copy(e);w.z=(d.positionScreen.z+e.positionScreen.z)/2;w.material=f.material;I.elements.push(w)},pushTriangle:function(a,c,k){var l=q[a],n=q[c],t=q[k];if(!1!==p(l,n,t)&&(g.side===THREE.DoubleSide||!0===r(l,n,t))){s=b();s.id=f.id;s.v1.copy(l);s.v2.copy(n);s.v3.copy(t);s.z=(l.positionScreen.z+n.positionScreen.z+t.positionScreen.z)/3;for(l=0;3>l;l++)n= -3*arguments[l],t=s.vertexNormalsModel[l],t.set(d[n],d[n+1],d[n+2]),t.applyMatrix3(h).normalize(),n=2*arguments[l],s.uvs[l].set(e[n],e[n+1]);s.vertexNormalsLength=3;s.material=f.material;I.elements.push(s)}}}};this.projectScene=function(f,h,k,l){var r,n,v,x,F,K,H,M;D=u=t=0;I.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();Q.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Y.multiplyMatrices(h.projectionMatrix,Q);R.setFromMatrix(Y);g=0;I.objects.length= +k(l)},pushNormal:function(a,b,c){d.push(a,b,c)},pushUv:function(a,b){e.push(a,b)},pushLine:function(a,b){var d=s[a],e=s[b];w=c();w.id=f.id;w.v1.copy(d);w.v2.copy(e);w.z=(d.positionScreen.z+e.positionScreen.z)/2;w.material=f.material;I.elements.push(w)},pushTriangle:function(a,c,k){var l=s[a],q=s[c],n=s[k];if(!1!==p(l,q,n)&&(g.side===THREE.DoubleSide||!0===r(l,q,n))){u=b();u.id=f.id;u.v1.copy(l);u.v2.copy(q);u.v3.copy(n);u.z=(l.positionScreen.z+q.positionScreen.z+n.positionScreen.z)/3;for(l=0;3>l;l++)q= +3*arguments[l],n=u.vertexNormalsModel[l],n.set(d[q],d[q+1],d[q+2]),n.applyMatrix3(h).normalize(),q=2*arguments[l],u.uvs[l].set(e[q],e[q+1]);u.vertexNormalsLength=3;u.material=f.material;I.elements.push(u)}}}};this.projectScene=function(f,h,k,l){var r,n,t,x,F,K,H,M;D=v=q=0;I.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();Q.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Y.multiplyMatrices(h.projectionMatrix,Q);R.setFromMatrix(Y);g=0;I.objects.length= 0;I.lights.length=0;V(f);!0===k&&I.objects.sort(d);f=0;for(k=I.objects.length;fF;F++)s.uvs[F].copy(ya[F]);s.color=v.color;s.material= -ma;s.z=(ia.positionScreen.z+Z.positionScreen.z+qa.positionScreen.z)/3;I.elements.push(s)}}}}}else if(r instanceof THREE.Line)if(n instanceof THREE.BufferGeometry){if(K=n.attributes,void 0!==K.position){H=K.position.array;n=0;for(x=H.length;nF;F++)u.uvs[F].copy(ya[F]);u.color=t.color;u.material= +ma;u.z=(ia.positionScreen.z+Z.positionScreen.z+qa.positionScreen.z)/3;I.elements.push(u)}}}}}else if(r instanceof THREE.Line)if(n instanceof THREE.BufferGeometry){if(K=n.attributes,void 0!==K.position){H=K.position.array;n=0;for(x=H.length;n=L.z&&(D===G?(x=new THREE.RenderableSprite,z.push(x),G++,D++,C=x):C=z[D++],C.id=r.id,C.x=L.x*n,C.y=L.y*n,C.z=L.z,C.object=r,C.rotation=r.rotation,C.scale.x=r.scale.x*Math.abs(C.x-(L.x+h.projectionMatrix.elements[0])/(L.w+h.projectionMatrix.elements[12])),C.scale.y=r.scale.y*Math.abs(C.y-(L.y+h.projectionMatrix.elements[5])/ (L.w+h.projectionMatrix.elements[13])),C.material=r.material,I.elements.push(C)));!0===l&&I.elements.sort(d);return I}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0}; THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;bb.max.x&&(b.max.x=e);fb.max.y&&(b.max.y=f);gb.max.z&&(b.max.z=g)}}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error("THREE.BufferGeometry.computeBoundingBox()",'Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')},computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null=== this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;eGa?-1:1;h[4*a]=wa.x;h[4*a+1]=wa.y;h[4*a+2]=wa.z;h[4*a+3]=Ia}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent= -{itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],p=0;pn;n++)t=a[3*c+n],-1==r[t]?(q[2*n]=t,q[2*n+1]=-1,p++):r[t]k.index+b)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)n=q[p+1],-1p;p+=2)t=q[p],n=q[p+1],-1===n&&(n=g++),r[t]=n,s[n]=t,e[f++]=n-k.index,k.count++}this.reorderBuffers(e,s,g);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array, +{itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],p=0;pn;n++)q=a[3*c+n],-1==r[q]?(s[2*n]=q,s[2*n+1]=-1,p++):r[q]k.index+b)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)n=s[p+1],-1p;p+=2)q=s[p],n=s[p+1],-1===n&&(n=g++),r[q]=n,u[n]=q,e[f++]=n-k.index,k.count++}this.reorderBuffers(e,u,g);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array, b,c,d,e=0,f=a.length;ed?-1:1,e.vertexTangents[c]=new THREE.Vector4(F.x,F.y,F.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd?-1:1,e.vertexTangents[c]=new THREE.Vector4(F.x,F.y,F.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;cc&&(h[f].counter+=1,g=h[f].hash+"_"+h[f].counter,g in this.geometryGroups||(this.geometryGroups[g]={faces3:[],materialIndex:f,vertices:0,numMorphTargets:k,numMorphNormals:l})),this.geometryGroups[g].faces3.push(d), this.geometryGroups[g].vertices+=3;this.geometryGroupsList=[];for(var p in this.geometryGroups)this.geometryGroups[p].id=a++,this.geometryGroupsList.push(this.geometryGroups[p])}}(),clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;ca.opacity)h.transparent=a.transparent;void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&& (h.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorAmbient&&(h.ambient=e(a.colorAmbient));a.colorEmissive&&(h.emissive=e(a.colorEmissive));a.transparency&&(h.opacity=a.transparency);a.specularCoef&&(h.shininess=a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse, a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset, @@ -245,12 +245,12 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)}; THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);if(void 0!==h.metadata&&"scene"===h.metadata.type){console.error('THREE.JSONLoader: "'+b+'" seems to be a Scene. Use THREE.SceneLoader instead.');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error('THREE.JSONLoader: "'+b+'" seems to be unreachable or the file is empty.'); a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+b+'" ('+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)}; -THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,p,q,r,s,t,n,v,w,u=a.faces;p=a.vertices;var x=a.normals,F=a.colors,C=0;if(void 0!==a.uvs){for(d=0;dg;g++)r=u[k++],w=v[2*r],r=v[2*r+1],w=new THREE.Vector2(w,r),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*u[k++],s.normal.set(x[q++],x[q++],x[q]),n.normal.copy(s.normal));if(t)for(d=0;4>d;d++)q=3*u[k++],t=new THREE.Vector3(x[q++], -x[q++],x[q]),2!==d&&s.vertexNormals.push(t),0!==d&&n.vertexNormals.push(t);p&&(p=u[k++],p=F[p],s.color.setHex(p),n.color.setHex(p));if(b)for(d=0;4>d;d++)p=u[k++],p=F[p],2!==d&&s.vertexColors.push(new THREE.Color(p)),0!==d&&n.vertexColors.push(new THREE.Color(p));c.faces.push(s);c.faces.push(n)}else{s=new THREE.Face3;s.a=u[k++];s.b=u[k++];s.c=u[k++];h&&(h=u[k++],s.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)r=u[k++],w=v[2*r],r=v[2*r+1], -w=new THREE.Vector2(w,r),c.faceVertexUvs[d][h].push(w);q&&(q=3*u[k++],s.normal.set(x[q++],x[q++],x[q]));if(t)for(d=0;3>d;d++)q=3*u[k++],t=new THREE.Vector3(x[q++],x[q++],x[q]),s.vertexNormals.push(t);p&&(p=u[k++],s.color.setHex(F[p]));if(b)for(d=0;3>d;d++)p=u[k++],s.vertexColors.push(new THREE.Color(F[p]));c.faces.push(s)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dg;g++)r=v[k++],w=t[2*r],r=t[2*r+1],w=new THREE.Vector2(w,r),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);s&&(s=3*v[k++],u.normal.set(x[s++],x[s++],x[s]),n.normal.copy(u.normal));if(q)for(d=0;4>d;d++)s=3*v[k++],q=new THREE.Vector3(x[s++], +x[s++],x[s]),2!==d&&u.vertexNormals.push(q),0!==d&&n.vertexNormals.push(q);p&&(p=v[k++],p=F[p],u.color.setHex(p),n.color.setHex(p));if(b)for(d=0;4>d;d++)p=v[k++],p=F[p],2!==d&&u.vertexColors.push(new THREE.Color(p)),0!==d&&n.vertexColors.push(new THREE.Color(p));c.faces.push(u);c.faces.push(n)}else{u=new THREE.Face3;u.a=v[k++];u.b=v[k++];u.c=v[k++];h&&(h=v[k++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)r=v[k++],w=t[2*r],r=t[2*r+1], +w=new THREE.Vector2(w,r),c.faceVertexUvs[d][h].push(w);s&&(s=3*v[k++],u.normal.set(x[s++],x[s++],x[s]));if(q)for(d=0;3>d;d++)s=3*v[k++],q=new THREE.Vector3(x[s++],x[s++],x[s]),u.vertexNormals.push(q);p&&(p=v[k++],u.color.setHex(F[p]));if(b)for(d=0;3>d;d++)p=v[k++],u.vertexColors.push(new THREE.Color(F[p]));c.faces.push(u)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dA&&B.clearRect(Z.min.x|0,Z.min.y|0,Z.max.x-Z.min.x|0,Z.max.y-Z.min.y|0),0R.positionScreen.z|| +function(a,b){y.set(a);A=void 0!==b?b:1;Z.min.set(-G,-I);Z.max.set(G,I)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){!1===Z.empty()&&(Z.intersect(ya),Z.expandByScalar(2),1>A&&B.clearRect(Z.min.x|0,Z.min.y|0,Z.max.x-Z.min.x|0,Z.max.y-Z.min.y|0),0R.positionScreen.z|| 1E.positionScreen.z||1da.positionScreen.z||1=O||(O*=L.intensity,M.add(Ea.multiplyScalar(O)))):L instanceof THREE.PointLight&&(Q=Da.setFromMatrixPosition(L.matrixWorld),O=m.dot(Da.subVectors(Q,D).normalize()),0>=O||(O*=0==L.distance? 1:1-Math.min(D.distanceTo(Q)/L.distance,1),0!=O&&(O*=L.intensity,M.add(Ea.multiplyScalar(O)))));fa.multiply(za).add(Ia);!0===y.wireframe?b(fa,y.wireframeLinewidth,y.wireframeLinecap,y.wireframeLinejoin):c(fa)}else y instanceof THREE.MeshBasicMaterial||y instanceof THREE.MeshLambertMaterial||y instanceof THREE.MeshPhongMaterial?null!==y.map?y.map.mapping instanceof THREE.UVMapping&&(ha=H.uvs,f(V,X,P,ga,wa,Ha,ha[0].x,ha[0].y,ha[1].x,ha[1].y,ha[2].x,ha[2].y,y.map)):null!==y.envMap?y.envMap.mapping instanceof THREE.SphericalReflectionMapping?(ja.copy(H.vertexNormalsModel[0]).applyMatrix3(ra),Oa=0.5*ja.x+0.5,Ra=0.5*ja.y+0.5,ja.copy(H.vertexNormalsModel[1]).applyMatrix3(ra),Sa=0.5*ja.x+0.5,Fa=0.5*ja.y+0.5,ja.copy(H.vertexNormalsModel[2]).applyMatrix3(ra),ia=0.5*ja.x+0.5,ma=0.5*ja.y+0.5,f(V,X,P,ga,wa,Ha,Oa,Ra,Sa,Fa,ia,ma,y.envMap)):y.envMap.mapping instanceof THREE.SphericalRefractionMapping&&(ja.copy(H.vertexNormalsModel[0]).applyMatrix3(ra),Oa=-0.5*ja.x+0.5,Ra=-0.5*ja.y+0.5,ja.copy(H.vertexNormalsModel[1]).applyMatrix3(ra), @@ -379,25 +379,25 @@ THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sa THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}};THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=m.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}} function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.length,g=d(b,a),p=f(g),n=e(g),r=g.vertexColors?g.vertexColors:!1;a.__vertexArray=new Float32Array(3*h);n&&(a.__normalArray=new Float32Array(3*h));c.hasTangents&&(a.__tangentArray=new Float32Array(4*h));r&&(a.__colorArray=new Float32Array(3*h));p&&(0n;n++)P.autoScaleCubemaps&&!f?(r=l,u=n,v=c.image[n],x=dc,v.width<=x&&v.height<=x||(F=Math.max(v.width,v.height),w=Math.floor(v.width*x/F),x=Math.floor(v.height*x/F),F=document.createElement("canvas"),F.width=w,F.height=x,F.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=F),r[u]=v):l[n]=c.image[n];n=l[0];r=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);u=M(c.format);v=M(c.type);A(m.TEXTURE_CUBE_MAP,c,r); -for(n=0;6>n;n++)if(f)for(x=l[n].mipmaps,F=0,y=x.length;Fn;n++)P.autoScaleCubemaps&&!f?(r=l,t=n,v=c.image[n],x=dc,v.width<=x&&v.height<=x||(F=Math.max(v.width,v.height),w=Math.floor(v.width*x/F),x=Math.floor(v.height*x/F),F=document.createElement("canvas"),F.width=w,F.height=x,F.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=F),r[t]=v):l[n]=c.image[n];n=l[0];r=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);t=M(c.format);v=M(c.type);A(m.TEXTURE_CUBE_MAP,c,r); +for(n=0;6>n;n++)if(f)for(x=l[n].mipmaps,F=0,y=x.length;F=Cb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Cb);Ea+=1;return a}function G(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function I(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function B(a){a!==ua&&(m.lineWidth(a),ua=a)}function y(a,b,c){ya!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),ya=a);!a||Z===b&&qa===c||(m.polygonOffset(b,c),Z=b,qa=c)}function A(a, b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,M(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,M(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,M(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,M(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(b.minFilter)));db&&b.type!==THREE.FloatType&&(1d.numSupportedMorphTargets?(n.sort(q),n.length=d.numSupportedMorphTargets):n.length> -d.numSupportedMorphNormals?n.sort(q):0===n.length&&n.push([0,0]);for(p=0;pd.numSupportedMorphTargets?(n.sort(s),n.length=d.numSupportedMorphTargets):n.length> +d.numSupportedMorphNormals?n.sort(s):0===n.length&&n.push([0,0]);for(p=0;pf;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);O(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(), -a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),A(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer): -a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):O(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Da,a=Ja,d=Ca,e=va);b!==Ha&&(m.bindFramebuffer(m.FRAMEBUFFER, -b),m.viewport(d,e,c,a),Ha=b);ja=c;ra=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: +0,k=g.length;hf;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture, +0);O(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),A(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom? +a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):O(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]: +a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Da,a=Ja,d=Ca,e=va);b!==Ha&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),Ha=b);ja=c;ra=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null}; THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps; -a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLProgram=function(){var a=0;return function(b,c,d,e){var f=b.context,g=d.fragmentShader,h=d.vertexShader,k=d.uniforms,l=d.attributes,p=d.defines,q=d.index0AttributeName;void 0===q&&!0===e.morphTargets&&(q="position");var r="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?r="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(r="SHADOWMAP_TYPE_PCF_SOFT");var s,t;s=[];for(var n in p)t=p[n],!1!==t&&(t="#define "+n+" "+t,s.push(t));s=s.join("\n");p=f.createProgram();d instanceof -THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",s,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP": +a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLProgram=function(){var a=0;return function(b,c,d,e){var f=b.context,g=d.fragmentShader,h=d.vertexShader,k=d.uniforms,l=d.attributes,p=d.defines,s=d.index0AttributeName;void 0===s&&!0===e.morphTargets&&(s="position");var r="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?r="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(r="SHADOWMAP_TYPE_PCF_SOFT");var u,q;u=[];for(var n in p)q=p[n],!1!==q&&(q="#define "+n+" "+q,u.push(q));u=u.join("\n");p=f.createProgram();d instanceof +THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",u,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP": "",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals?"#define USE_MORPHNORMALS":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED": "",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+r:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"), -b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap?"#extension GL_OES_standard_derivatives : enable":"",s,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"",e.useFog&&e.fog?"#define USE_FOG": +b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap?"#extension GL_OES_standard_derivatives : enable":"",u,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"",e.useFog&&e.fog?"#define USE_FOG": "",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.vertexColors?"#define USE_COLOR":"",e.metal?"#define METAL":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled? -"#define "+r:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));h=new THREE.WebGLShader(f,f.VERTEX_SHADER,d+h);g=new THREE.WebGLShader(f,f.FRAGMENT_SHADER,b+g);f.attachShader(p,h);f.attachShader(p,g);void 0!==q&&f.bindAttribLocation(p,0,q);f.linkProgram(p);!1===f.getProgramParameter(p,f.LINK_STATUS)&&(console.error("Could not initialise shader"), -console.error("gl.VALIDATE_STATUS",f.getProgramParameter(p,f.VALIDATE_STATUS)),console.error("gl.getError()",f.getError()));""!==f.getProgramInfoLog(p)&&console.error("gl.getProgramInfoLog()",f.getProgramInfoLog(p));f.deleteShader(h);f.deleteShader(g);q="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&& -q.push("logDepthBufFC");for(var v in k)q.push(v);k=q;v={};q=0;for(b=k.length;qa?b(c,e-1):l[e]a?b(c,e-1):l[e]>8&255,l>>16&255,l>>24&255)),e}e.mipmapCount=1;k[2]&131072&&!1!==b&&(e.mipmapCount=Math.max(1,k[7]));e.isCubemap=k[28]&512?!0:!1;e.width=k[4];e.height=k[3];for(var k=k[1]+4,g=e.width,h=e.height,l=e.isCubemap?6:1,q=0;qq-1?0:q-1,s=q+1>e-1?e-1:q+1,t=0>p-1?0:p-1,n=p+1>d-1?d-1:p+1,v=[],w=[0,0,h[4*(q*d+p)]/255*b];v.push([-1,0,h[4*(q*d+t)]/255*b]);v.push([-1,-1,h[4*(r*d+t)]/255*b]);v.push([0,-1,h[4*(r*d+p)]/255*b]);v.push([1,-1,h[4*(r*d+n)]/255*b]);v.push([1,0,h[4*(q*d+n)]/255*b]);v.push([1,1,h[4*(s*d+n)]/255*b]);v.push([0,1,h[4*(s*d+p)]/255*b]);v.push([-1,1,h[4*(s*d+t)]/255*b]);r=[];t=v.length;for(s=0;s +a.length&&console.error("ImageUtils::decodeTGA()- Not enough data to contain header.");var b=new Uint8Array(a),c=0,d={id_length:b[c++],colormap_type:b[c++],image_type:b[c++],colormap_index:b[c++]|b[c++]<<8,colormap_length:b[c++]|b[c++]<<8,colormap_size:b[c++],origin:[b[c++]|b[c++]<<8,b[c++]|b[c++]<<8],width:b[c++]|b[c++]<<8,height:b[c++]|b[c++]<<8,pixel_size:b[c++],flags:b[c++]};(function(a){switch(a.image_type){case 1:case 9:(256=a.width||0>=a.height)&&console.error("ImageUtils::tgaCheckHeader() - Invalid image size");8!==a.pixel_size&&16!==a.pixel_size&&24!==a.pixel_size&&32!==a.pixel_size&&console.error('ImageUtils::tgaCheckHeader() - Invalid pixel size "'+ +a.pixel_size+'"')})(d);d.id_length+c>a.length&&console.error("ImageUtils::load() - No data");var c=c+d.id_length,e=a=!1,f=!1;switch(d.image_type){case 9:e=a=!0;break;case 1:e=!0;break;case 10:a=!0;break;case 11:f=a=!0;break;case 3:f=!0}b=function(a,b,c,d,e){var f,r,u;f=c.pixel_size>>3;r=c.width*c.height*f;b&&(u=e.subarray(d,d+=3*c.colormap_length));if(a){a=new Uint8Array(r);var q;c=0;for(var n=new Uint8Array(f);c>4){default:case 2:p=0;s=1;u=a;a=0;r=1;q=b;break;case 0:p=0;s=1;u=a;a=b-1;q=r=-1;break;case 3:p=a-1;u=s=-1;a=0;r=1;q=b;break;case 1:p=a-1,u=s=-1,a=b-1,q=r=-1}if(f)switch(d.pixel_size){case 8:e=r;b=q;q=0;var t,w;r=d.width;for(w=a;w!==b;w+=e)for(t=p;t!==u;t+=s,q++)a=c[q],n[4* +(t+r*w)+0]=a,n[4*(t+r*w)+1]=a,n[4*(t+r*w)+2]=a,n[4*(t+r*w)+3]=255;break;case 16:e=r;b=q;q=0;r=d.width;for(t=a;t!==b;t+=e)for(a=p;a!==u;a+=s,q+=2)n[4*(a+r*t)+0]=c[q+0],n[4*(a+r*t)+1]=c[q+0],n[4*(a+r*t)+2]=c[q+0],n[4*(a+r*t)+3]=c[q+1];break;default:console.error("ImageUtils::getTgaRGBA() - not support this format")}else switch(d.pixel_size){case 8:b=r;r=0;var v;t=d.width;for(v=a;v!==q;v+=b)for(w=p;w!==u;w+=s,r++)a=c[r],n[4*(w+t*v)+3]=255,n[4*(w+t*v)+2]=e[3*a+0],n[4*(w+t*v)+1]=e[3*a+1],n[4*(w+t*v)+0]= +e[3*a+2];break;case 16:e=r;b=q;q=0;r=d.width;for(w=a;w!==b;w+=e)for(t=p;t!==u;t+=s,q+=2)a=c[q+0]+(c[q+1]<<8),n[4*(t+r*w)+0]=(a&31744)>>7,n[4*(t+r*w)+1]=(a&992)>>2,n[4*(t+r*w)+2]=(a&31)>>3,n[4*(t+r*w)+3]=a&32768?0:255;break;case 24:e=r;b=q;q=0;r=d.width;for(t=a;t!==b;t+=e)for(a=p;a!==u;a+=s,q+=3)n[4*(a+r*t)+3]=255,n[4*(a+r*t)+2]=c[q+0],n[4*(a+r*t)+1]=c[q+1],n[4*(a+r*t)+0]=c[q+2];break;case 32:e=r;b=q;q=0;r=d.width;for(t=a;t!==b;t+=e)for(a=p;a!==u;a+=s,q+=4)n[4*(a+r*t)+2]=c[q+0],n[4*(a+r*t)+1]=c[q+ +1],n[4*(a+r*t)+0]=c[q+2],n[4*(a+r*t)+3]=c[q+3];break;default:console.error("ImageUtils::getTgaRGBA() - not support this format")}return n}(d.width,d.height,b.pixel_data,b.palettes);return{width:d.width,height:d.height,data:b}},loadTGATexture:function(a,b,c,d){var e=new THREE.TGATexture;b=new XMLHttpRequest;b.open("GET",a,!0);b.responseType="arraybuffer";b.onload=function(){if(200===this.status){var b=THREE.ImageUtils.decodeTGA(this.response);if(b)return e.image=b,e.sourceFile=a,e.needsUpdate=!0,e}}; +b.addEventListener("load",function(a){c&&c(e)},!1);b.addEventListener("error",function(a){d&&d(a)},!1);b.send(null);e.sourceFile=a;return e},loadDDSTexture:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;var g=new XMLHttpRequest;g.onload=function(){var a=THREE.ImageUtils.parseDDS(g.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d>8&255,l>>16&255,l>>24&255)),e}e.mipmapCount=1;k[2]&131072&&!1!==b&&(e.mipmapCount=Math.max(1,k[7]));e.isCubemap=k[28]&512?!0:!1;e.width=k[4]; +e.height=k[3];for(var k=k[1]+4,g=e.width,h=e.height,l=e.isCubemap?6:1,s=0;ss-1?0:s-1,u=s+1>e-1?e-1:s+1,q=0>p-1?0:p-1,n=p+1>d-1?d-1:p+1,t=[],w=[0,0,h[4*(s*d+p)]/255*b];t.push([-1,0,h[4*(s*d+q)]/255*b]);t.push([-1,-1,h[4*(r*d+q)]/255*b]);t.push([0,-1,h[4*(r*d+p)]/255*b]);t.push([1,-1,h[4*(r*d+n)]/255*b]);t.push([1,0,h[4*(s*d+n)]/255*b]);t.push([1,1,h[4*(u*d+n)]/255*b]);t.push([0,1,h[4*(u*d+p)]/255* +b]);t.push([-1,1,h[4*(u*d+q)]/255*b]);r=[];q=t.length;for(u=0;ue)return null;var f=[],g=[],h=[],k,l,p;if(0=q--){console.log("Warning, unable to triangulate polygon!");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);p=l+1;e<=p&&(p=0);var r;a:{var s=r=void 0,t=void 0,n=void 0,v=void 0,w=void 0,u=void 0,x=void 0,F= -void 0,s=a[g[k]].x,t=a[g[k]].y,n=a[g[l]].x,v=a[g[l]].y,w=a[g[p]].x,u=a[g[p]].y;if(1E-10>(n-s)*(u-t)-(v-t)*(w-s))r=!1;else{var C=void 0,D=void 0,z=void 0,G=void 0,I=void 0,B=void 0,y=void 0,A=void 0,O=void 0,L=void 0,O=A=y=F=x=void 0,C=w-n,D=u-v,z=s-w,G=t-u,I=n-s,B=v-t;for(r=0;re)return null;var f=[],g=[],h=[],k,l,p;if(0=s--){console.log("Warning, unable to triangulate polygon!");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);p=l+1;e<=p&&(p=0);var r;a:{var u=r=void 0,q=void 0,n=void 0,t=void 0,w=void 0,v=void 0,x=void 0,F= +void 0,u=a[g[k]].x,q=a[g[k]].y,n=a[g[l]].x,t=a[g[l]].y,w=a[g[p]].x,v=a[g[p]].y;if(1E-10>(n-u)*(v-q)-(t-q)*(w-u))r=!1;else{var C=void 0,D=void 0,z=void 0,G=void 0,I=void 0,B=void 0,y=void 0,A=void 0,O=void 0,L=void 0,O=A=y=F=x=void 0,C=w-n,D=v-t,z=u-w,G=q-v,I=n-u,B=t-q;for(r=0;rk)g=d+1;else if(0b&&(b=0);1=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;cb?b=h.x:h.xc?c=h.y:h.yd?d=h.z:h.zb?b=h.x:h.xc?c=h.y:h.yd?d=h.z:h.zMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; +THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,k,l,p,s,r,u,q,n;d=0;for(e=this.actions.length;dMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;cl&&(g=b[f],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<= h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;bG||G>z)return[];k=l*p-k*q;if(0>k||k>z)return[]}else{if(0d?[]:k==d?f?[]:[g]:a<=d?[g,h]: +THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.xG||G>z)return[];k=l*p-k*s;if(0>k||k>z)return[]}else{if(0d?[]:k==d?f?[]:[g]:a<=d?[g,h]: [g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1; -d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;cL){console.log("Infinite Loop! Holes left:"+ -l.length+", Probably Hole outside Shape!");break}for(q=B;qh;h++)l=k[h].x+":"+k[h].y, -l=p[l],void 0!==l&&(k[h]=l);return q.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a, +d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;cL){console.log("Infinite Loop! Holes left:"+ +l.length+", Probably Hole outside Shape!");break}for(s=B;sh;h++)l=k[h].x+":"+k[h].y, +l=p[l],void 0!==l&&(k[h]=l);return s.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a, b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)}; THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)}; THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype); @@ -581,12 +588,12 @@ d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.AnimationHandler={LINEAR:0,CAT THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.stop(this)}; THREE.Animation.prototype.reset=function(){for(var a=0,b=this.hierarchy.length;ad;d++){for(var e=this.keyTypes[d],f=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(e,a,1);g.timef.index;)f=g,g=this.getNextKeyWith(e,a,g.index+1);c.prevKey[e]=f;c.nextKey[e]=g}}}; -THREE.Animation.prototype.update=function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,q,r,s,t,n;e=(a.length-1)*b;q=Math.floor(e);e-=q;c[0]=0===q?q:q-1;c[1]=q;c[2]=q>a.length-2?q:q+1;c[3]=q>a.length-3?q:q+2;q=a[c[0]];s=a[c[1]];t=a[c[2]];n=a[c[3]];c=e*e;r=e*c;d[0]=f(q[0],s[0],t[0],n[0],e,c,r);d[1]=f(q[1],s[1],t[1],n[1],e,c,r);d[2]=f(q[2],s[2],t[2],n[2],e,c,r);return d},f=function(a,b,c,d,e,f,r){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)* -r+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){var h;f=this.data.length;if(!0===this.loop&&this.currentTime>f)this.currentTime%=f,this.reset();else if(!1===this.loop&&this.currentTime>f){this.stop();return}f=0;for(var k=this.hierarchy.length;fq;q++){h=this.keyTypes[q];var r=p.prevKey[h],s=p.nextKey[h];if(s.time<=this.currentTime){r=this.data.hierarchy[f].keys[0]; -for(s=this.getNextKeyWith(h,f,1);s.timer.index;)r=s,s=this.getNextKeyWith(h,f,s.index+1);p.prevKey[h]=r;p.nextKey[h]=s}l.matrixAutoUpdate=!0;l.matrixWorldNeedsUpdate=!0;var t=(this.currentTime-r.time)/(s.time-r.time),n=r[h],v=s[h];0>t&&(t=0);1a.length-2?s:s+1;c[3]=s>a.length-3?s:s+2;s=a[c[0]];u=a[c[1]];q=a[c[2]];n=a[c[3]];c=e*e;r=e*c;d[0]=f(s[0],u[0],q[0],n[0],e,c,r);d[1]=f(s[1],u[1],q[1],n[1],e,c,r);d[2]=f(s[2],u[2],q[2],n[2],e,c,r);return d},f=function(a,b,c,d,e,f,r){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)* +r+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){var h;f=this.data.length;if(!0===this.loop&&this.currentTime>f)this.currentTime%=f,this.reset();else if(!1===this.loop&&this.currentTime>f){this.stop();return}f=0;for(var k=this.hierarchy.length;fs;s++){h=this.keyTypes[s];var r=p.prevKey[h],u=p.nextKey[h];if(u.time<=this.currentTime){r=this.data.hierarchy[f].keys[0]; +for(u=this.getNextKeyWith(h,f,1);u.timer.index;)r=u,u=this.getNextKeyWith(h,f,u.index+1);p.prevKey[h]=r;p.nextKey[h]=u}l.matrixAutoUpdate=!0;l.matrixWorldNeedsUpdate=!0;var q=(this.currentTime-r.time)/(u.time-r.time),n=r[h],t=u[h];0>q&&(q=0);1=e)return new THREE.Vector2(c,a);e=Math.sqrt(e/2)}else a=!1,1E-10e?-1E-10>g&& -(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(E=c.length;0<=--E;){e=E;f=E-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*p,g=0;gMath.abs(c-k)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(q,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(k,1-f),new THREE.Vector2(p,1-g),new THREE.Vector2(r,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2; +(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(E=c.length;0<=--E;){e=E;f=E-1;0>f&&(f=c.length-1);for(var g=0,h=u+2*p,g=0;gMath.abs(c-k)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(s,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(k,1-f),new THREE.Vector2(p,1-g),new THREE.Vector2(r,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2; THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;cc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/ -Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);c=c||1;d=d||0;for(var k=this,l=0,p=a.length;ls&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));l=0;for(p=this.vertices.length;lc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/ +Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);c=c||1;d=d||0;for(var k=this,l=0,p=a.length;lu&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>s&&(b[2].x+=1));l=0;for(p=this.vertices.length;lc.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}(); THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=0.2*a);void 0===c&&(c=0.2*b);this.line.scale.set(1,a,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};THREE.BoxHelper=function(a){var b=[new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,1),new THREE.Vector3(1,-1,1),new THREE.Vector3(1,1,-1),new THREE.Vector3(-1,1,-1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1)];this.vertices=b;var c=new THREE.Geometry;c.vertices.push(b[0],b[1],b[1],b[2],b[2],b[3],b[3],b[0],b[4],b[5],b[5],b[6],b[6],b[7],b[7],b[4],b[0],b[4],b[1],b[5],b[2],b[6],b[3],b[7]);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces); @@ -654,7 +661,7 @@ THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THR 1.1,-1);d("u2",-0.7,1.1,-1);d("u3",0,2,-1);d("cf1",-1,0,1);d("cf2",1,0,1);d("cf3",0,-1,1);d("cf4",0,1,1);d("cn1",-1,0,-1);d("cn2",1,0,-1);d("cn3",0,-1,-1);d("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0}}();THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;b=b||1;var c=new THREE.Geometry;c.vertices.push(new THREE.Vector3(-b,b,0),new THREE.Vector3(b,b,0),new THREE.Vector3(b,-b,0),new THREE.Vector3(-b,-b,0),new THREE.Vector3(-b,b,0));var d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new THREE.Line(c,d);this.add(this.lightPlane); c=new THREE.Geometry;c.vertices.push(new THREE.Vector3,new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype); THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()}; -THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var l=k.vertices,k=k.faces,p=0,q=0,r=k.length;qt;t++){d[0]=s[g[t]];d[1]=s[g[(t+1)%3]];d.sort(f);var n=d.toString();void 0===e[n]?(e[n]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},p++):e[n].face2=q}h.addAttribute("position",new THREE.Float32Attribute(6*p,3));d=h.attributes.position.array; +THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var l=k.vertices,k=k.faces,p=0,s=0,r=k.length;sq;q++){d[0]=u[g[q]];d[1]=u[g[(q+1)%3]];d.sort(f);var n=d.toString();void 0===e[n]?(e[n]={vert1:d[0],vert2:d[1],face1:s,face2:void 0},p++):e[n].face2=s}h.addAttribute("position",new THREE.Float32Attribute(6*p,3));d=h.attributes.position.array; f=0;for(n in e)if(g=e[n],void 0===g.face2||0.9999>k[g.face1].normal.dot(k[g.face2].normal))p=l[g.vert1],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z,p=l[g.vert2],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z;THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;cb;b++)a.faces[b].color=this.colors[4>b?0:1];b=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(a,b);this.add(this.lightSphere); @@ -664,13 +671,13 @@ THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this THREE.SkeletonHelper.prototype=Object.create(THREE.Line.prototype);THREE.SkeletonHelper.prototype.update=function(){for(var a=this.geometry,b=0,c=0;cn;n++){d[0]=t[g[n]];d[1]=t[g[(n+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[v]=!0,p++)}h.addAttribute("position",new THREE.Float32Attribute(6*p,3));d= -h.attributes.position.array;r=0;for(s=p;rn;n++)p=k[q[2*r+n]],g=6*r+3*n,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,s=a.geometry.attributes.index.array,l=a.geometry.offsets,p=0,q=new Uint32Array(2*s.length),t=0,w=l.length;tn;n++)d[0]=g+s[r+n],d[1]=g+s[r+(n+1)%3],d.sort(f),v=d.toString(), -void 0===e[v]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[v]=!0,p++);h.addAttribute("position",new THREE.Float32Attribute(6*p,3));d=h.attributes.position.array;r=0;for(s=p;rn;n++)g=6*r+3*n,p=3*q[2*r+n],d[g+0]=k[p],d[g+1]=k[p+1],d[g+2]=k[p+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(k=a.geometry.attributes.position.array,p=k.length/3,q=p/3,h.addAttribute("position",new THREE.Float32Attribute(6*p,3)),d=h.attributes.position.array,r=0,s=q;rn;n++)g=18*r+6*n,q=9*r+3*n, -d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],p=9*r+(n+1)%3*3,d[g+3]=k[p],d[g+4]=k[p+1],d[g+5]=k[p+2];THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype); +THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;kn;n++){d[0]=q[g[n]];d[1]=q[g[(n+1)%3]];d.sort(f);var t=d.toString();void 0===e[t]&&(s[2*p]=d[0],s[2*p+1]=d[1],e[t]=!0,p++)}h.addAttribute("position",new THREE.Float32Attribute(6*p,3));d= +h.attributes.position.array;r=0;for(u=p;rn;n++)p=k[s[2*r+n]],g=6*r+3*n,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,u=a.geometry.attributes.index.array,l=a.geometry.offsets,p=0,s=new Uint32Array(2*u.length),q=0,w=l.length;qn;n++)d[0]=g+u[r+n],d[1]=g+u[r+(n+1)%3],d.sort(f),t=d.toString(), +void 0===e[t]&&(s[2*p]=d[0],s[2*p+1]=d[1],e[t]=!0,p++);h.addAttribute("position",new THREE.Float32Attribute(6*p,3));d=h.attributes.position.array;r=0;for(u=p;rn;n++)g=6*r+3*n,p=3*s[2*r+n],d[g+0]=k[p],d[g+1]=k[p+1],d[g+2]=k[p+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(k=a.geometry.attributes.position.array,p=k.length/3,s=p/3,h.addAttribute("position",new THREE.Float32Attribute(6*p,3)),d=h.attributes.position.array,r=0,u=s;rn;n++)g=18*r+6*n,s=9*r+3*n, +d[g+0]=k[s],d[g+1]=k[s+1],d[g+2]=k[s+2],p=9*r+(n+1)%3*3,d[g+3]=k[p],d[g+4]=k[p+1],d[g+5]=k[p+2];THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype); THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})}; THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;ad.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight; -f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,k,l,p,q,r,s;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1; -e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);k=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16, +f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,k,l,p,s,r,u;this.init=function(q){b=q.context;c=q;d=q.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);q=0;e[q++]=-1;e[q++]=-1; +e[q++]=0;e[q++]=0;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);k=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16, 0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,l);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE); -b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(p=!1,q=a(THREE.ShaderFlares.lensFlare,d)):(p=!0,q=a(THREE.ShaderFlares.lensFlareVertexTexture,d));r={};s={};r.vertex=b.getAttribLocation(q,"position");r.uv=b.getAttribLocation(q,"uv");s.renderType=b.getUniformLocation(q,"renderType");s.map=b.getUniformLocation(q,"map");s.occlusionMap=b.getUniformLocation(q,"occlusionMap");s.opacity= -b.getUniformLocation(q,"opacity");s.color=b.getUniformLocation(q,"color");s.scale=b.getUniformLocation(q,"scale");s.rotation=b.getUniformLocation(q,"rotation");s.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var u=a.length;if(u){var x=new THREE.Vector3,F=f/e,C=0.5*e,D=0.5*f,z=16/f,G=new THREE.Vector2(z*F,z),I=new THREE.Vector3(1,1,0),B=new THREE.Vector2(1,1),y=s,z=r;b.useProgram(q);b.enableVertexAttribArray(r.vertex);b.enableVertexAttribArray(r.uv); -b.uniform1i(y.occlusionMap,0);b.uniform1i(y.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var A,O,L,M,K;for(A=0;A=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(p=!1,s=a(THREE.ShaderFlares.lensFlare,d)):(p=!0,s=a(THREE.ShaderFlares.lensFlareVertexTexture,d));r={};u={};r.vertex=b.getAttribLocation(s,"position");r.uv=b.getAttribLocation(s,"uv");u.renderType=b.getUniformLocation(s,"renderType");u.map=b.getUniformLocation(s,"map");u.occlusionMap=b.getUniformLocation(s,"occlusionMap");u.opacity= +b.getUniformLocation(s,"opacity");u.color=b.getUniformLocation(s,"color");u.scale=b.getUniformLocation(s,"scale");u.rotation=b.getUniformLocation(s,"rotation");u.screenPosition=b.getUniformLocation(s,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var v=a.length;if(v){var x=new THREE.Vector3,F=f/e,C=0.5*e,D=0.5*f,z=16/f,G=new THREE.Vector2(z*F,z),I=new THREE.Vector3(1,1,0),B=new THREE.Vector2(1,1),y=u,z=r;b.useProgram(s);b.enableVertexAttribArray(r.vertex);b.enableVertexAttribArray(r.uv); +b.uniform1i(y.occlusionMap,0);b.uniform1i(y.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var A,O,L,M,K;for(A=0;AF;F++)G[F]=new THREE.Vector3,u[F]=new THREE.Vector3;G=C.shadowCascadeNearZ[x];C=C.shadowCascadeFarZ[x];u[0].set(-1,-1,G);u[1].set(1,-1,G);u[2].set(-1, -1,G);u[3].set(1,1,G);u[4].set(-1,-1,C);u[5].set(1,-1,C);u[6].set(-1,1,C);u[7].set(1,1,C);z.originalCamera=r;u=new THREE.Gyroscope;u.position.copy(n.shadowCascadeOffset);u.add(z);u.add(z.target);r.add(u);n.shadowCascadeArray[w]=z;console.log("Created virtualLight",z)}x=n;G=w;C=x.shadowCascadeArray[G];C.position.copy(x.position);C.target.position.copy(x.target.position);C.lookAt(C.target);C.shadowCameraVisible=x.shadowCameraVisible;C.shadowDarkness=x.shadowDarkness;C.shadowBias=x.shadowCascadeBias[G]; -u=x.shadowCascadeNearZ[G];x=x.shadowCascadeFarZ[G];C=C.pointsFrustum;C[0].z=u;C[1].z=u;C[2].z=u;C[3].z=u;C[4].z=x;C[5].z=x;C[6].z=x;C[7].z=x;D[v]=z;v++}else D[v]=n,v++;s=0;for(t=D.length;sx;x++)G=C[x],G.copy(u[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(G,w),G.applyMatrix4(v.matrixWorldInverse),G.xl.x&&(l.x=G.x),G.yl.y&&(l.y=G.y),G.zl.z&&(l.z=G.z);v.left=k.x;v.right=l.x;v.top=l.y;v.bottom=k.y;v.updateProjectionMatrix()}v=n.shadowMap;u=n.shadowMatrix;w=n.shadowCamera;w.position.setFromMatrixPosition(n.matrixWorld);p.setFromMatrixPosition(n.target.matrixWorld);w.lookAt(p);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5, -0,0,0.5,0.5,0,0,0,1);u.multiply(w.projectionMatrix);u.multiply(w.matrixWorldInverse);h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();C=q.__webglObjects;n=0;for(v=C.length;n 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); -u.compileShader(y);u.compileShader(A);u.attachShader(w,y);u.attachShader(w,A);u.linkProgram(w);I=w;n=u.getAttribLocation(I,"position");v=u.getAttribLocation(I,"uv");a=u.getUniformLocation(I,"uvOffset");b=u.getUniformLocation(I,"uvScale");c=u.getUniformLocation(I,"rotation");d=u.getUniformLocation(I,"scale");e=u.getUniformLocation(I,"color");f=u.getUniformLocation(I,"map");g=u.getUniformLocation(I,"opacity");h=u.getUniformLocation(I,"modelViewMatrix");k=u.getUniformLocation(I,"projectionMatrix");l= -u.getUniformLocation(I,"fogType");p=u.getUniformLocation(I,"fogDensity");q=u.getUniformLocation(I,"fogNear");r=u.getUniformLocation(I,"fogFar");s=u.getUniformLocation(I,"fogColor");t=u.getUniformLocation(I,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;y=w.getContext("2d");y.fillStyle="#ffffff";y.fillRect(0,0,w.width,w.height);F=new THREE.Texture(w);F.needsUpdate=!0};this.render=function(B,y,A,C){A=B.__webglSprites;if(C=A.length){u.useProgram(I);u.enableVertexAttribArray(n); -u.enableVertexAttribArray(v);u.disable(u.CULL_FACE);u.enable(u.BLEND);u.bindBuffer(u.ARRAY_BUFFER,z);u.vertexAttribPointer(n,2,u.FLOAT,!1,16,0);u.vertexAttribPointer(v,2,u.FLOAT,!1,16,8);u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,G);u.uniformMatrix4fv(k,!1,y.projectionMatrix.elements);u.activeTexture(u.TEXTURE0);u.uniform1i(f,0);var D=0,M=0,K=B.fog;K?(u.uniform3f(s,K.color.r,K.color.g,K.color.b),K instanceof THREE.Fog?(u.uniform1f(q,K.near),u.uniform1f(r,K.far),u.uniform1i(l,1),M=D=1):K instanceof THREE.FogExp2&& -(u.uniform1f(p,K.density),u.uniform1i(l,2),M=D=2)):(u.uniform1i(l,0),M=D=0);for(var H,Q=[],K=0;KF;F++)G[F]=new THREE.Vector3,v[F]=new THREE.Vector3;G=C.shadowCascadeNearZ[x];C=C.shadowCascadeFarZ[x];v[0].set(-1,-1,G);v[1].set(1,-1,G);v[2].set(-1, +1,G);v[3].set(1,1,G);v[4].set(-1,-1,C);v[5].set(1,-1,C);v[6].set(-1,1,C);v[7].set(1,1,C);z.originalCamera=r;v=new THREE.Gyroscope;v.position.copy(n.shadowCascadeOffset);v.add(z);v.add(z.target);r.add(v);n.shadowCascadeArray[w]=z;console.log("Created virtualLight",z)}x=n;G=w;C=x.shadowCascadeArray[G];C.position.copy(x.position);C.target.position.copy(x.target.position);C.lookAt(C.target);C.shadowCameraVisible=x.shadowCameraVisible;C.shadowDarkness=x.shadowDarkness;C.shadowBias=x.shadowCascadeBias[G]; +v=x.shadowCascadeNearZ[G];x=x.shadowCascadeFarZ[G];C=C.pointsFrustum;C[0].z=v;C[1].z=v;C[2].z=v;C[3].z=v;C[4].z=x;C[5].z=x;C[6].z=x;C[7].z=x;D[t]=z;t++}else D[t]=n,t++;u=0;for(q=D.length;ux;x++)G=C[x],G.copy(v[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(G,w),G.applyMatrix4(t.matrixWorldInverse),G.xl.x&&(l.x=G.x),G.yl.y&&(l.y=G.y),G.zl.z&&(l.z=G.z);t.left=k.x;t.right=l.x;t.top=l.y;t.bottom=k.y;t.updateProjectionMatrix()}t=n.shadowMap;v=n.shadowMatrix;w=n.shadowCamera;w.position.setFromMatrixPosition(n.matrixWorld);p.setFromMatrixPosition(n.target.matrixWorld);w.lookAt(p);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5, +0,0,0.5,0.5,0,0,0,1);v.multiply(w.projectionMatrix);v.multiply(w.matrixWorldInverse);h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(t);b.clear();C=s.__webglObjects;n=0;for(t=C.length;n 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); +v.compileShader(y);v.compileShader(A);v.attachShader(w,y);v.attachShader(w,A);v.linkProgram(w);I=w;n=v.getAttribLocation(I,"position");t=v.getAttribLocation(I,"uv");a=v.getUniformLocation(I,"uvOffset");b=v.getUniformLocation(I,"uvScale");c=v.getUniformLocation(I,"rotation");d=v.getUniformLocation(I,"scale");e=v.getUniformLocation(I,"color");f=v.getUniformLocation(I,"map");g=v.getUniformLocation(I,"opacity");h=v.getUniformLocation(I,"modelViewMatrix");k=v.getUniformLocation(I,"projectionMatrix");l= +v.getUniformLocation(I,"fogType");p=v.getUniformLocation(I,"fogDensity");s=v.getUniformLocation(I,"fogNear");r=v.getUniformLocation(I,"fogFar");u=v.getUniformLocation(I,"fogColor");q=v.getUniformLocation(I,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;y=w.getContext("2d");y.fillStyle="#ffffff";y.fillRect(0,0,w.width,w.height);F=new THREE.Texture(w);F.needsUpdate=!0};this.render=function(B,y,A,C){A=B.__webglSprites;if(C=A.length){v.useProgram(I);v.enableVertexAttribArray(n); +v.enableVertexAttribArray(t);v.disable(v.CULL_FACE);v.enable(v.BLEND);v.bindBuffer(v.ARRAY_BUFFER,z);v.vertexAttribPointer(n,2,v.FLOAT,!1,16,0);v.vertexAttribPointer(t,2,v.FLOAT,!1,16,8);v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,G);v.uniformMatrix4fv(k,!1,y.projectionMatrix.elements);v.activeTexture(v.TEXTURE0);v.uniform1i(f,0);var D=0,M=0,K=B.fog;K?(v.uniform3f(u,K.color.r,K.color.g,K.color.b),K instanceof THREE.Fog?(v.uniform1f(s,K.near),v.uniform1f(r,K.far),v.uniform1i(l,1),M=D=1):K instanceof THREE.FogExp2&& +(v.uniform1f(p,K.density),v.uniform1i(l,2),M=D=2)):(v.uniform1i(l,0),M=D=0);for(var H,Q=[],K=0;K 256 || header.colormap_size !== 24 || header.colormap_type !== 1) { + console.error('Targa::tgaCheckHeader() - Invalid type colormap data for indexed type'); + } + break; + + // Check colormap type + case TGA_TYPE_RGB: + case TGA_TYPE_GREY: + case TGA_TYPE_RLE_RGB: + case TGA_TYPE_RLE_GREY: + if (header.colormap_type) { + console.error('ImageUtils::tgaCheckHeader() - Invalid type colormap data for colormap type'); + } + break; + + // What the need of a file without data ? + case TGA_TYPE_NO_DATA: + console.error('ImageUtils::tgaCheckHeader() - No data'); + + // Invalid type ? + default: + console.error('ImageUtils::tgaCheckHeader() - Invalid type " '+ header.image_type + '"'); + } + + // Check image width and height + if ( header.width <= 0 || header.height <=0 ) { + console.error( 'ImageUtils::tgaCheckHeader() - Invalid image size' ); + } + + // Check image pixel size + if (header.pixel_size !== 8 && + header.pixel_size !== 16 && + header.pixel_size !== 24 && + header.pixel_size !== 32) { + console.error('ImageUtils::tgaCheckHeader() - Invalid pixel size "' + header.pixel_size + '"'); + } + } + + // Check tga if it is valid format + tgaCheckHeader( header ); + + if ( header.id_length + offset > arrayBuffer.length ) { + console.error('ImageUtils::load() - No data'); + } + + // Skip the needn't data + offset += header.id_length; + + // Get targa information about RLE compression and palette + var use_rle = false, + use_pal = false, + use_grey = false; + + switch ( header.image_type ) { + case TGA_TYPE_RLE_INDEXED: + use_rle = true; + use_pal = true; + break; + + case TGA_TYPE_INDEXED: + use_pal = true; + break; + + case TGA_TYPE_RLE_RGB: + use_rle = true; + break; + + case TGA_TYPE_RGB: + break; + + case TGA_TYPE_RLE_GREY: + use_rle = true; + use_grey = true; + break; + + case TGA_TYPE_GREY: + use_grey = true; + break; + } + + // Parse tga image buffer + function tgaParse( use_rle, use_pal, header, offset, data ) { + + var pixel_data, + pixel_size, + pixel_total, + palettes; + + pixel_size = header.pixel_size >> 3; + pixel_total = header.width * header.height * pixel_size; + + // Read palettes + if ( use_pal ) { + palettes = data.subarray( offset, offset += header.colormap_length * 3 ); + } + + // Read RLE + if ( use_rle ) { + pixel_data = new Uint8Array(pixel_total); + + var c, count, i; + var shift = 0; + var pixels = new Uint8Array(pixel_size); + + while (shift < pixel_total) { + c = data[offset++]; + count = (c & 0x7f) + 1; + + // RLE pixels. + if (c & 0x80) { + // Bind pixel tmp array + for (i = 0; i < pixel_size; ++i) { + pixels[i] = data[offset++]; + } + + // Copy pixel array + for (i = 0; i < count; ++i) { + pixel_data.set(pixels, shift + i * pixel_size); + } + + shift += pixel_size * count; + } + + // Raw pixels. + else { + count *= pixel_size; + for (i = 0; i < count; ++i) { + pixel_data[shift + i] = data[offset++]; + } + shift += count; + } + } + } + // RAW Pixels + else { + pixel_data = data.subarray( + offset, offset += (use_pal ? header.width * header.height : pixel_total) + ); + } + + return { + pixel_data: pixel_data, + palettes: palettes + }; + } + + function tgaGetImageData8bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end + , image, palettes ) { + var colormap = palettes; + var color, i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i++) { + color = image[i]; + imageData[(x + width * y) * 4 + 3] = 255; + imageData[(x + width * y) * 4 + 2] = colormap[(color * 3) + 0]; + imageData[(x + width * y) * 4 + 1] = colormap[(color * 3) + 1]; + imageData[(x + width * y) * 4 + 0] = colormap[(color * 3) + 2]; + } + } + + return imageData; + }; + + function tgaGetImageData16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end + , image) { + var color, i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 2) { + color = image[i + 0] + (image[i + 1] << 8); // Inversed ? + imageData[(x + width * y) * 4 + 0] = (color & 0x7C00) >> 7; + imageData[(x + width * y) * 4 + 1] = (color & 0x03E0) >> 2; + imageData[(x + width * y) * 4 + 2] = (color & 0x001F) >> 3; + imageData[(x + width * y) * 4 + 3] = (color & 0x8000) ? 0 : 255; + } + } + + return imageData; + }; + + function tgaGetImageData24bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) { + var i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 3) { + imageData[(x + width * y) * 4 + 3] = 255; + imageData[(x + width * y) * 4 + 2] = image[i + 0]; + imageData[(x + width * y) * 4 + 1] = image[i + 1]; + imageData[(x + width * y) * 4 + 0] = image[i + 2]; + } + } + + return imageData; + }; + + function tgaGetImageData32bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) { + var i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 4) { + imageData[(x + width * y) * 4 + 2] = image[i + 0]; + imageData[(x + width * y) * 4 + 1] = image[i + 1]; + imageData[(x + width * y) * 4 + 0] = image[i + 2]; + imageData[(x + width * y) * 4 + 3] = image[i + 3]; + } + } + + return imageData; + }; + + function tgaGetImageDataGrey8bits( imageData, y_start, y_step, y_end, x_start, x_step, x_end, image ) { + var color, i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i++) { + color = image[i]; + imageData[(x + width * y) * 4 + 0] = color; + imageData[(x + width * y) * 4 + 1] = color; + imageData[(x + width * y) * 4 + 2] = color; + imageData[(x + width * y) * 4 + 3] = 255; + } + } + + return imageData; + }; + + function tgaGetImageDataGrey16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) { + var i = 0, x, y; + var width = header.width; + + for (y = y_start; y !== y_end; y += y_step) { + for (x = x_start; x !== x_end; x += x_step, i += 2) { + imageData[(x + width * y) * 4 + 0] = image[i + 0]; + imageData[(x + width * y) * 4 + 1] = image[i + 0]; + imageData[(x + width * y) * 4 + 2] = image[i + 0]; + imageData[(x + width * y) * 4 + 3] = image[i + 1]; + } + } + + return imageData; + }; + + function getTgaRGBA( width, height, image, palette ) { + var x_start, + y_start, + x_step, + y_step, + x_end, + y_end, + data = new Uint8Array(width * height * 4); + + switch( (header.flags & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT ) { + default: + case TGA_ORIGIN_UL: + x_start = 0; + x_step = 1; + x_end = width; + y_start = 0; + y_step = 1; + y_end = height; + break; + + case TGA_ORIGIN_BL: + x_start = 0; + x_step = 1; + x_end = width; + y_start = height - 1; + y_step = -1; + y_end = -1; + break; + + case TGA_ORIGIN_UR: + x_start = width - 1; + x_step = -1; + x_end = -1; + y_start = 0; + y_step = 1; + y_end = height; + break; + + case TGA_ORIGIN_BR: + x_start = width - 1; + x_step = -1; + x_end = -1; + y_start = height - 1; + y_step = -1; + y_end = -1; + break; + } + + + if ( use_grey ) { + + switch( header.pixel_size ) + { + case 8: + tgaGetImageDataGrey8bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + case 16: + tgaGetImageDataGrey16bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + default: + console.error( 'ImageUtils::getTgaRGBA() - not support this format' ); + break; + } + + } + else { + + switch( header.pixel_size ) + { + case 8: + tgaGetImageData8bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image, palette ); + break; + + case 16: + tgaGetImageData16bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + + case 24: + tgaGetImageData24bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + + case 32: + tgaGetImageData32bits( data, y_start, y_step, y_end, x_start, x_step, x_end, image ); + break; + + default: + console.error( 'ImageUtils::getTgaRGBA() - not support this format' ); + break; + } + } + // Load image data according to specific method + // var func = 'tgaGetImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits'; + //func(data, y_start, y_step, y_end, x_start, x_step, x_end, width, image, palette ); + return data; + } + + var result = tgaParse( use_rle, use_pal, header, offset, content ); + var rgbaData = getTgaRGBA( header.width, header.height, result.pixel_data, result.palettes ); + + + return { + width: header.width, + height: header.height, + data: rgbaData + }; + }, + + loadTGATexture: function ( url, mapping, onLoad, onError ) { + + var texture = new THREE.TGATexture(); + { + var request = new XMLHttpRequest(); + + request.open( 'GET', url, true ); + request.responseType = "arraybuffer"; + request.onload = function() { + if ( this.status === 200 ) { + var imageData = THREE.ImageUtils.decodeTGA( this.response ); + + if ( imageData ) { + texture.image = imageData; + texture.sourceFile = url; + texture.needsUpdate = true; + + return texture; + } + + } + }; + + request.addEventListener( 'load', function ( event ) { + + if ( onLoad ) onLoad( texture ); + + }, false ); + + request.addEventListener( 'error', function ( event ) { + + if ( onError ) onError( event ); + + }, false ); + + request.send(null); + } + + texture.sourceFile = url; + + return texture; + }, loadDDSTexture: function ( url, mapping, onLoad, onError ) { diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 3b4126f5b8e858705a4cab85a234e56bc6701725..256e0d27aaa0a7368dfd9a2d5baac2d7f472f484 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -5546,7 +5546,11 @@ THREE.WebGLRenderer = function ( parameters ) { } - } else { // regular Texture (image, video, canvas) + } else if ( texture instanceof THREE.TGATexture ) { + var tgaImg = texture.image; + _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, tgaImg.width, tgaImg.height, 0, glFormat, glType, tgaImg.data ); + + } else { // regular Texture (image, video, canvas) // use manually created mipmaps if available // if there are no manual mipmaps diff --git a/src/textures/TGATexture.js b/src/textures/TGATexture.js new file mode 100644 index 0000000000000000000000000000000000000000..335170d69925b7620047b82ba28212fab2623c1e --- /dev/null +++ b/src/textures/TGATexture.js @@ -0,0 +1,19 @@ +/** + * @author Daosheng Mu / https://github.com/DaoshengMu/ + */ + +THREE.TGATexture = function ( format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) { + + THREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); +}; + +THREE.TGATexture.prototype = Object.create( THREE.Texture.prototype ); + +THREE.TGATexture.prototype.clone = function() { + + var texture = new THREE.TGATexture(); + + THREE.Texture.prototype.clone.all( this. texture ); + + return texture; +}; \ No newline at end of file diff --git a/utils/build/includes/common.json b/utils/build/includes/common.json index 46913ec9084f94ea1b0b9ec856728bcc85aab221..1bf58b18f2fdbbef763450d3c2fcb814d1fa97d3 100644 --- a/utils/build/includes/common.json +++ b/utils/build/includes/common.json @@ -64,6 +64,7 @@ "src/materials/SpriteCanvasMaterial.js", "src/textures/Texture.js", "src/textures/CompressedTexture.js", + "src/textures/TGATexture.js", "src/textures/DataTexture.js", "src/objects/PointCloud.js", "src/objects/Line.js", diff --git a/utils/build/includes/webgl.json b/utils/build/includes/webgl.json index 5934d45ab39bc9db4ea6de53f20efcc930fb5c96..fb88e9a7a3e082f02dffd497ad5405e4257604c8 100644 --- a/utils/build/includes/webgl.json +++ b/utils/build/includes/webgl.json @@ -55,6 +55,7 @@ "src/materials/SpriteMaterial.js", "src/textures/Texture.js", "src/textures/CompressedTexture.js", + "src/textures/TGATexture.js", "src/textures/DataTexture.js", "src/objects/PointCloud.js", "src/objects/Line.js",