UNPKG

wwobjloader2

Version:

New OBJLoader utilizing web worker for three.js

1,081 lines (352 loc) 15.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Documentation Class: WorkerSupport</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.simplex.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">Documentation</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="THREE.LoaderSupport.Builder.html">THREE.LoaderSupport.Builder</a></li><li><a href="THREE.LoaderSupport.Callbacks.html">THREE.LoaderSupport.Callbacks</a></li><li><a href="THREE.LoaderSupport.ConsoleLogger.html">THREE.LoaderSupport.ConsoleLogger</a></li><li><a href="THREE.LoaderSupport.LoadedMeshUserOverride.html">THREE.LoaderSupport.LoadedMeshUserOverride</a></li><li><a href="THREE.LoaderSupport.LoaderBase.html">THREE.LoaderSupport.LoaderBase</a></li><li><a href="THREE.LoaderSupport.PrepData.html">THREE.LoaderSupport.PrepData</a></li><li><a href="THREE.LoaderSupport.ResourceDescriptor.html">THREE.LoaderSupport.ResourceDescriptor</a></li><li><a href="THREE.LoaderSupport.Validator.html">THREE.LoaderSupport.Validator</a></li><li><a href="THREE.LoaderSupport.WorkerDirector.html">THREE.LoaderSupport.WorkerDirector</a></li><li><a href="THREE.LoaderSupport.WorkerRunnerRefImpl.html">THREE.LoaderSupport.WorkerRunnerRefImpl</a></li><li><a href="THREE.LoaderSupport.WorkerSupport.html">THREE.LoaderSupport.WorkerSupport</a></li><li><a href="THREE.OBJLoader2.html">THREE.OBJLoader2</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content"> <div class="row"> <div class="col-md-8"> <div id="main"> <h1 class="page-title">Class: WorkerSupport</h1> <section> <header> <h2> WorkerSupport </h2> </header> <article> <div class="container-overview"> <hr> <dt> <h4 class="name" id="WorkerSupport"><span class="type-signature"></span>new WorkerSupport(logger)</h4> </dt> <dd> <div class="description"> <p>This class provides means to transform existing parser code into a web worker. It defines a simple communication protocol which allows to configure the worker and receive raw mesh data during execution.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>logger</code></td> <td class="type"> <span class="param-type"><a href="THREE.LoaderSupport.ConsoleLogger.html">THREE.LoaderSupport.ConsoleLogger</a></span> </td> <td class="description last"><p>logger to be used</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> </div> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id="run"><span class="type-signature">&lt;static> </span>WorkerSupport#run(payload)</h4> </dt> <dd> <div class="description"> <p>Runs the parser with the provided configuration.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>payload</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Raw mesh description (buffers, params, materials) used to build one to many meshes.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <hr> <dt> <h4 class="name" id="setCallbacks"><span class="type-signature">&lt;static> </span>WorkerSupport#setCallbacks(builder, onLoad)</h4> </dt> <dd> <div class="description"> <p>Specify functions that should be build when new raw mesh data becomes available and when the parser is finished.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>builder</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>The builder function. Default is <a href="THREE.LoaderSupport.Builder.html">THREE.LoaderSupport.Builder</a>.</p></td> </tr> <tr> <td class="name"><code>onLoad</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>The function that is called when parsing is complete.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <hr> <dt> <h4 class="name" id="setTerminateRequested"><span class="type-signature">&lt;static> </span>WorkerSupport#setTerminateRequested(terminateRequested)</h4> </dt> <dd> <div class="description"> <p>Request termination of worker once parser is finished.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>terminateRequested</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last"><p>True or false.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <hr> <dt> <h4 class="name" id="terminateWorker"><span class="type-signature">&lt;static> </span>WorkerSupport#terminateWorker()</h4> </dt> <dd> <div class="description"> <p>Terminate the worker and the code.</p> </div> <dl class="details"> </dl> </dd> <hr> <dt> <h4 class="name" id="validate"><span class="type-signature">&lt;static> </span>WorkerSupport#validate(functionCodeBuilder, forceWorkerReload, libLocations, libPath, runnerImpl)</h4> </dt> <dd> <div class="description"> <p>Validate the status of worker code and the derived worker.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>functionCodeBuilder</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.</p></td> </tr> <tr> <td class="name"><code>forceWorkerReload</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last"><p>Force re-build of the worker code.</p></td> </tr> <tr> <td class="name"><code>libLocations</code></td> <td class="type"> <span class="param-type">Array.&lt;String></span> </td> <td class="description last"><p>URL of libraries that shall be added to worker code relative to libPath</p></td> </tr> <tr> <td class="name"><code>libPath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>Base path used for loading libraries</p></td> </tr> <tr> <td class="name"><code>runnerImpl</code></td> <td class="type"> <span class="param-type"><a href="THREE.LoaderSupport.WorkerRunnerRefImpl.html">THREE.LoaderSupport.WorkerRunnerRefImpl</a></span> </td> <td class="description last"><p>The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> </dl> </article> </section> </div> </div> <div class="clearfix"></div> <div class="col-md-3"> <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div> </div> </div> </div> <div class="modal fade" id="searchResults"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Search results</h4> </div> <div class="modal-body"></div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div> <footer> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on October 24th 2017, 10:38:01 pm using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. </span> </footer> <script src="scripts/docstrap.lib.js"></script> <script src="scripts/toc.js"></script> <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script> <script> $( function () { $( "[id*='$']" ).each( function () { var $this = $( this ); $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) ); } ); $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { var $this = $( this ); var example = $this.find( "code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html( exampleText ); lang = lang[1]; } else { var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); lang = langClassMatch ? langClassMatch[1] : "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu : true, enableDoclinks : true } ); $.catchAnchorLinks( { navbarOffset: 10 } ); $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", showAndHide : false, smoothScrolling: true } ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); $( '.dropdown-toggle' ).dropdown(); $( "table" ).each( function () { var $this = $( this ); $this.addClass('table'); } ); } ); </script> <!--Navigation and Symbol Display--> <!--Google Analytics--> <script type="text/javascript"> $(document).ready(function() { SearcherDisplay.init(); }); </script> </body> </html>