In order to use the types THREE.FloatType and THREE.HalfFloatType, the WebGL implementation must support the respective extensions OES_texture_float and OES_texture_half_float. In order to use THREE.LinearFilter for component-wise, bilinear interpolation of the texels based on these types, the WebGL extensions OES_texture_float_linear or OES_texture_half_float_linear must also be present.
In order to use the types THREE.FloatType and THREE.HalfFloatType, the WebGL implementation must support the respective extensions OES_texture_float and OES_texture_half_float. In order to use THREE.LinearFilter for component-wise, bilinear interpolation of the texels based on these types, the WebGL extensions OES_texture_float_linear or OES_texture_half_float_linear must also be present.
</div>
</div>
+ <h2>Example</h2>
+
+ <code>
+ // create a buffer with color data
+
+ var size = width * height;
+ var data = new Uint8Array( 3 * size );
+
+ var r = Math.floor( color.r * 255 );
+ var g = Math.floor( color.g * 255 );
+ var b = Math.floor( color.b * 255 );
+
+ for ( var i = 0; i < size; i ++ ) {
+
+ var stride = i * 3;
+
+ data[ stride ] = r;
+ data[ stride + 1 ] = g;
+ data[ stride + 2 ] = b;
+
+ }
+
+ // used the buffer to create a [name]
+
+ var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );
[page:Function functionCodeBuilder] - Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.<br>
[page:Function functionCodeBuilder] - Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.<br>
- [page:Boolean forceWorkerReload] - Force re-build of the worker code.<br>
Array of [page:String libLocations] - URL of libraries that shall be added to worker code relative to libPath.<br>
Array of [page:String libLocations] - URL of libraries that shall be added to worker code relative to libPath.<br>
[page:String libPath] - Base path used for loading libraries.<br>
[page:String libPath] - Base path used for loading libraries.<br>
[page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] - The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
[page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] - The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
- "!doc": "An Image object, typically created using the ImageUtils or [page:ImageLoader ImageLoader] classes. The Image object can include an image (e.g., PNG, JPG, GIF, DDS), video (e.g., MP4, OGG/OGV), or set of six images for a cube map. To use video as a texture you need to have a playing HTML5 video element as a source for your texture image and continuously update this texture as long as video is playing."
+ "!doc": "An Image object, typically created using the [page:ImageLoader ImageLoader] class. The Image object can include an image (e.g., PNG, JPG, GIF, DDS), video (e.g., MP4, OGG/OGV), or set of six images for a cube map. To use video as a texture you need to have a playing HTML5 video element as a source for your texture image and continuously update this texture as long as video is playing."
-a.a,a=a.m,a.j=a.m,a.g=a.o);if(h=a.a.Z)h.g=a,a.j=h,a.a.Z=null;if(h=e.Y)h.j=a,a.g=h,e.Y=null}s=k.k;s.R=[];k=0;for(a=s.r.length;k<a;k++)if(e=s.r[k],!e.w){a:{h=f=d=void 0;g=e;f=h=e.a;e.w=!0;for(e=e.g;d=e.a;){if(e.w){if(d==f)break;console.log("ERR unique_monotone: segment in two chains",f,e);e=null;break a}e.w=!0;1==r.c.G(d,h)&&(h=d,g=e);e=e.g}e=g}e&&s.R.push(e)}s=k=new X(l);k=s.k.R;s.k.T=[];for(a=0;a<k.length;a++)if(f=k[a],e=f.j,d=f.g,d.g==e)B(s.k,f.a,d.a,e.a);else if(e=s,d=f.g,f=f.a,h=[d.a],g=0,d=d.g,
-p=d.a,p!=f){for(;p!=f||1<g;)if(0<g)if(t=r.c.N(h[g],p,h[g-1]),Math.abs(t)<=r.c.n&&(p==f||r.c.G(h[g],p)==r.c.G(h[g],h[g-1]))&&(t=1),0<t)B(e.k,h[g-1],h[g],p),g--;else if(h[++g]=p,p==f)for(console.log("ERR uni-y-monotone: only concave angles left",h);1<g;)g--,B(e.k,h[g-1],h[g],h[g+1]);else d=d.g,p=d.a;else h[++g]=p,d=d.g,p=d.a;B(e.k,h[g-1],h[g],p)}}this.M=l;return l.T.concat()}};window.PNLTRI=r;r.REVISION=r.ca;r.Math=r.c;r.Triangulator=Z;Z.prototype.clear_lastData=Z.prototype.W;Z.prototype.get_PolyLeftArr=Z.prototype.Q;Z.prototype.triangulate_polygon=Z.prototype.ea;
+ // set referemce to this, then processing in worker scope within "_receiveWorkerMessage" can access members
+ this.worker.runtimeRef = this;
- this.callbacks = {
- builder: null,
- onLoad: null
+ // process stored queuedMessage
+ this._postMessage();
};
};
- }
- /**
- * Validate the status of worker code and the derived worker.
- * @memberOf THREE.LoaderSupport.WorkerSupport
- *
- * @param {Function} functionCodeBuilder Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.
- * @param {boolean} forceWorkerReload Force re-build of the worker code.
- * @param {String[]} libLocations URL of libraries that shall be added to worker code relative to libPath
- * @param {String} libPath Base path used for loading libraries
- * @param {THREE.LoaderSupport.WorkerRunnerRefImpl} runnerImpl The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
- var loadAllLibraries = function ( path, locations ) {
- if ( locations.length === 0 ) {
+ // check worker support first
+ if ( window.Worker === undefined ) throw "This browser does not support web workers!";
+ if ( window.Blob === undefined ) throw "This browser does not support Blob!";
+ if ( typeof window.URL.createObjectURL !== 'function' ) throw "This browser does not support Object creation from URL!";
- buildWorkerCode( libsContent );
+ this.loaderWorker = new LoaderWorker( this.logger );
+ }
- } else {
+ /**
+ * Validate the status of worker code and the derived worker.
+ * @memberOf THREE.LoaderSupport.WorkerSupport
+ *
+ * @param {Function} functionCodeBuilder Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.
+ * @param {String[]} libLocations URL of libraries that shall be added to worker code relative to libPath
+ * @param {String} libPath Base path used for loading libraries
+ * @param {THREE.LoaderSupport.WorkerRunnerRefImpl} runnerImpl The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
+if ( THREE.LoaderSupport === undefined ) console.error( '"THREE.LoaderSupport" is not available. "THREE.OBJLoader2" requires it. Please include "LoaderSupport.js" in your HTML.' );
+
/**
/**
* Use this class to load OBJ data from files or to parse OBJ data from an arraybuffer
* Use this class to load OBJ data from files or to parse OBJ data from an arraybuffer
- <a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - procedural 3D text by <a href="http://www.lab4games.net/zz85/blog" target="_blank" rel="noopener">zz85</a> & alteredq
- <br/>built-in shape triangulation has been replaced with <a href="https://github.com/mapbox/earcut">Earcut</a> by <a href="https://github.com/mourner" target="_blank" rel="noopener">mourner</a>
- <br/>type to enter new text, drag to spin the text
- <a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - procedural 3D text by <a href="http://www.lab4games.net/zz85/blog" target="_blank" rel="noopener">zz85</a> & alteredq
- <br/>built-in shape triangulation has been replaced with <a href="https://github.com/jahting/pnltri.js">PnlTri.js</a> by <a href="https://github.com/jahting" target="_blank" rel="noopener">j ahting</a>
- <br/>type to enter new text, drag to spin the text
( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below
( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below