|
@@ -63,6 +63,7 @@
|
|
|
import { LoadedMeshUserOverride } from "./jsm/loaders/obj2/shared/MeshReceiver.js";
|
|
|
|
|
|
const WWOBJLoader2Example = function ( elementToBindTo ) {
|
|
|
+
|
|
|
this.renderer = null;
|
|
|
this.canvas = elementToBindTo;
|
|
|
this.aspectRatio = 1;
|
|
@@ -88,6 +89,7 @@
|
|
|
|
|
|
this.cube = null;
|
|
|
this.pivot = null;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
WWOBJLoader2Example.prototype = {
|
|
@@ -95,6 +97,7 @@
|
|
|
constructor: WWOBJLoader2Example,
|
|
|
|
|
|
initGL: function () {
|
|
|
+
|
|
|
this.renderer = new THREE.WebGLRenderer( {
|
|
|
canvas: this.canvas,
|
|
|
antialias: true,
|
|
@@ -108,22 +111,22 @@
|
|
|
this.resetCamera();
|
|
|
this.controls = new TrackballControls( this.camera, this.renderer.domElement );
|
|
|
|
|
|
- let ambientLight = new THREE.AmbientLight( 0x404040 );
|
|
|
- let directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
|
|
|
- let directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
|
|
|
+ const ambientLight = new THREE.AmbientLight( 0x404040 );
|
|
|
+ const directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
|
|
|
+ const directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
|
|
|
|
|
|
- directionalLight1.position.set( -100, -50, 100 );
|
|
|
- directionalLight2.position.set( 100, 50, -100 );
|
|
|
+ directionalLight1.position.set( - 100, - 50, 100 );
|
|
|
+ directionalLight2.position.set( 100, 50, - 100 );
|
|
|
|
|
|
this.scene.add( directionalLight1 );
|
|
|
this.scene.add( directionalLight2 );
|
|
|
this.scene.add( ambientLight );
|
|
|
|
|
|
- let helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
|
|
|
+ const helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
|
|
|
this.scene.add( helper );
|
|
|
|
|
|
- let geometry = new THREE.BoxBufferGeometry( 10, 10, 10 );
|
|
|
- let material = new THREE.MeshNormalMaterial();
|
|
|
+ const geometry = new THREE.BoxBufferGeometry( 10, 10, 10 );
|
|
|
+ const material = new THREE.MeshNormalMaterial();
|
|
|
this.cube = new THREE.Mesh( geometry, material );
|
|
|
this.cube.position.set( 0, 0, 0 );
|
|
|
this.scene.add( this.cube );
|
|
@@ -131,25 +134,29 @@
|
|
|
this.pivot = new THREE.Object3D();
|
|
|
this.pivot.name = 'Pivot';
|
|
|
this.scene.add( this.pivot );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
useParseMain: function () {
|
|
|
- let modelName = 'female02';
|
|
|
+
|
|
|
+ const modelName = 'female02';
|
|
|
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
|
|
|
|
|
|
- let objLoader2 = new OBJLoader2()
|
|
|
+ const objLoader2 = new OBJLoader2()
|
|
|
.setModelName( modelName );
|
|
|
|
|
|
- let scope = this;
|
|
|
- function onLoadMtl ( mtlParseResult ) {
|
|
|
+ const scope = this;
|
|
|
+ function onLoadMtl( mtlParseResult ) {
|
|
|
+
|
|
|
objLoader2.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
|
|
|
|
|
|
- let fileLoader = new THREE.FileLoader();
|
|
|
+ const fileLoader = new THREE.FileLoader();
|
|
|
fileLoader.setPath( '' );
|
|
|
fileLoader.setResponseType( 'arraybuffer' );
|
|
|
fileLoader.load( 'models/obj/female02/female02.obj',
|
|
|
- function ( content, message ) {
|
|
|
- let local = new THREE.Object3D();
|
|
|
+ function ( content ) {
|
|
|
+
|
|
|
+ const local = new THREE.Object3D();
|
|
|
local.name = 'Pivot_female02';
|
|
|
local.position.set( 75, 0, 0 );
|
|
|
scope.pivot.add( local );
|
|
@@ -157,138 +164,165 @@
|
|
|
|
|
|
scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: OBJLoader2#pase: Parsing completed' } } );
|
|
|
scope.finalize();
|
|
|
+
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- let mtlLoader = new MTLLoader();
|
|
|
+ const mtlLoader = new MTLLoader();
|
|
|
mtlLoader.load( 'models/obj/female02/female02.mtl', onLoadMtl );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
useParseParallel: function () {
|
|
|
- let modelName = 'female02_vertex' ;
|
|
|
+
|
|
|
+ const modelName = 'female02_vertex';
|
|
|
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
|
|
|
|
|
|
- let local = new THREE.Object3D();
|
|
|
+ const local = new THREE.Object3D();
|
|
|
local.name = 'Pivot_female02_vertex';
|
|
|
- local.position.set( -75, 0, 0 );
|
|
|
+ local.position.set( - 75, 0, 0 );
|
|
|
this.pivot.add( local );
|
|
|
|
|
|
- let scope = this;
|
|
|
+ const scope = this;
|
|
|
function callbackOnLoad( object3d, message ) {
|
|
|
+
|
|
|
local.add( object3d );
|
|
|
scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: ' + message } } );
|
|
|
scope.finalize();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- let materials = {
|
|
|
+ const materials = {
|
|
|
tester: new THREE.MeshStandardMaterial()
|
|
|
};
|
|
|
|
|
|
- let objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
+ const objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
.setModelName( modelName )
|
|
|
.setJsmWorker( this.useJsmWorker, new URL( OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH, window.location.href ) )
|
|
|
.setCallbackOnLoad( callbackOnLoad )
|
|
|
.addMaterials( materials, true );
|
|
|
|
|
|
- let fileLoader = new THREE.FileLoader();
|
|
|
+ const fileLoader = new THREE.FileLoader();
|
|
|
fileLoader.setPath( '' );
|
|
|
fileLoader.setResponseType( 'arraybuffer' );
|
|
|
fileLoader.load( 'models/obj/female02/female02_vertex_colors.obj',
|
|
|
function ( content ) {
|
|
|
+
|
|
|
objLoader2Parallel.parse( content );
|
|
|
+
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
},
|
|
|
|
|
|
useLoadMain: function () {
|
|
|
- let modelName = 'male02';
|
|
|
+
|
|
|
+ const modelName = 'male02';
|
|
|
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
|
|
|
|
|
|
- let objLoader2 = new OBJLoader2()
|
|
|
- .setModelName( modelName )
|
|
|
- .setUseIndices( true );
|
|
|
+ const objLoader2 = new OBJLoader2()
|
|
|
+ .setModelName( modelName )
|
|
|
+ .setUseIndices( true );
|
|
|
+
|
|
|
+ const scope = this;
|
|
|
+ function callbackOnLoad( object3d, message ) {
|
|
|
|
|
|
- let scope = this;
|
|
|
- function callbackOnLoad ( object3d, message ) {
|
|
|
- let local = new THREE.Object3D();
|
|
|
+ const local = new THREE.Object3D();
|
|
|
local.name = 'Pivot_male02';
|
|
|
- local.position.set( 0, 0, -75 );
|
|
|
+ local.position.set( 0, 0, - 75 );
|
|
|
scope.pivot.add( local );
|
|
|
local.add( object3d );
|
|
|
|
|
|
scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: ' + message } } );
|
|
|
scope.finalize();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- function onLoadMtl ( mtlParseResult ) {
|
|
|
+ function onLoadMtl( mtlParseResult ) {
|
|
|
+
|
|
|
objLoader2.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
|
|
|
objLoader2.load( 'models/obj/male02/male02.obj', callbackOnLoad, null, null, null );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- let mtlLoader = new MTLLoader();
|
|
|
+ const mtlLoader = new MTLLoader();
|
|
|
mtlLoader.load( 'models/obj/male02/male02.mtl', onLoadMtl );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
useLoadParallel: function () {
|
|
|
- let modelName = 'WaltHead';
|
|
|
+
|
|
|
+ const modelName = 'WaltHead';
|
|
|
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
|
|
|
|
|
|
- let local = new THREE.Object3D();
|
|
|
+ const local = new THREE.Object3D();
|
|
|
local.name = 'Pivot_WaltHead';
|
|
|
- local.position.set( -175, 50, 0 );
|
|
|
- let scale = 0.5;
|
|
|
+ local.position.set( - 175, 50, 0 );
|
|
|
+ const scale = 0.5;
|
|
|
local.scale.set( scale, scale, scale );
|
|
|
this.pivot.add( local );
|
|
|
|
|
|
- let objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
+ const objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
.setModelName( modelName )
|
|
|
.setJsmWorker( this.useJsmWorker, new URL( OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH, window.location.href ) );
|
|
|
|
|
|
- let scope = this;
|
|
|
- function callbackOnLoad ( object3d, message ) {
|
|
|
+ const scope = this;
|
|
|
+ function callbackOnLoad( object3d, message ) {
|
|
|
+
|
|
|
local.add( object3d );
|
|
|
scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: ' + message } } );
|
|
|
scope.finalize();
|
|
|
+
|
|
|
}
|
|
|
- function onLoadMtl ( mtlParseResult ) {
|
|
|
+
|
|
|
+ function onLoadMtl( mtlParseResult ) {
|
|
|
+
|
|
|
objLoader2Parallel.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
|
|
|
objLoader2Parallel.load( 'models/obj/walt/WaltHead.obj', callbackOnLoad );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- let mtlLoader = new MTLLoader();
|
|
|
+ const mtlLoader = new MTLLoader();
|
|
|
mtlLoader.load( 'models/obj/walt/WaltHead.mtl', onLoadMtl );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
useLoadMainFallback: function () {
|
|
|
- let local = new THREE.Object3D();
|
|
|
+
|
|
|
+ const local = new THREE.Object3D();
|
|
|
local.name = 'Pivot_Cerberus';
|
|
|
local.position.set( 0, 0, 100 );
|
|
|
- let scale = 50;
|
|
|
+ const scale = 50;
|
|
|
local.scale.set( scale, scale, scale );
|
|
|
this.pivot.add( local );
|
|
|
|
|
|
- let objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
+ const objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
.setModelName( local.name )
|
|
|
.setExecuteParallel( false );
|
|
|
|
|
|
- let scope = this;
|
|
|
- function callbackOnLoad ( object3d, message ) {
|
|
|
+ const scope = this;
|
|
|
+ function callbackOnLoad( object3d, message ) {
|
|
|
+
|
|
|
local.add( object3d );
|
|
|
scope._reportProgress( { detail: { text: 'Loading of ' + objLoader2Parallel.modelName + ' completed: ' + message } } );
|
|
|
scope.finalize();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
objLoader2Parallel.load( 'models/obj/cerberus/Cerberus.obj', callbackOnLoad );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
useLoadParallelMeshAlter: function () {
|
|
|
- let local = new THREE.Object3D();
|
|
|
- local.position.set( 175, -100, 0 );
|
|
|
+
|
|
|
+ const local = new THREE.Object3D();
|
|
|
+ local.position.set( 175, - 100, 0 );
|
|
|
local.name = 'Pivot_ninjaHead';
|
|
|
this.pivot.add( local );
|
|
|
|
|
|
- let objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
+ const objLoader2Parallel = new OBJLoader2Parallel()
|
|
|
.setModelName( local.name )
|
|
|
.setJsmWorker( this.useJsmWorker, new URL( OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH, window.location.href ) )
|
|
|
.setBaseObject3d( local );
|
|
@@ -296,77 +330,97 @@
|
|
|
// Configure WorkerExecutionSupport to not disregard worker after execution
|
|
|
objLoader2Parallel.getWorkerExecutionSupport().setTerminateWorkerOnLoad( false );
|
|
|
|
|
|
- function callbackMeshAlter ( event ) {
|
|
|
- let override = new LoadedMeshUserOverride( false, true );
|
|
|
+ function callbackMeshAlter( event ) {
|
|
|
+
|
|
|
+ const override = new LoadedMeshUserOverride( false, true );
|
|
|
|
|
|
- let mesh = new THREE.Mesh( event.detail.bufferGeometry, event.detail.material );
|
|
|
+ const mesh = new THREE.Mesh( event.detail.bufferGeometry, event.detail.material );
|
|
|
mesh.name = event.detail.meshName;
|
|
|
- let helper = new VertexNormalsHelper( mesh, 2, 0x00ff00 );
|
|
|
+ const helper = new VertexNormalsHelper( mesh, 2, 0x00ff00 );
|
|
|
helper.name = 'VertexNormalsHelper';
|
|
|
|
|
|
override.addMesh( mesh );
|
|
|
override.addMesh( helper );
|
|
|
|
|
|
return override;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
objLoader2Parallel.setCallbackOnMeshAlter( callbackMeshAlter );
|
|
|
|
|
|
- let scope = this;
|
|
|
- function callbackOnLoad ( object3d, message ) {
|
|
|
+ const scope = this;
|
|
|
+ function callbackOnLoad( object3d, message ) {
|
|
|
+
|
|
|
scope._reportProgress( { detail: { text: 'Loading of ' + objLoader2Parallel.modelName + ' completed: ' + message } } );
|
|
|
scope.finalize();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
objLoader2Parallel.load( 'models/obj/ninja/ninjaHead_Low.obj', callbackOnLoad );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
finalize: function () {
|
|
|
- this.loadCount--;
|
|
|
+
|
|
|
+ this.loadCount --;
|
|
|
if ( this.loadCount === 0 ) {
|
|
|
|
|
|
this._reportProgress( { detail: { text: '' } } );
|
|
|
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
- _reportProgress: function( event ) {
|
|
|
+ _reportProgress: function ( event ) {
|
|
|
+
|
|
|
let output = '';
|
|
|
if ( event.detail !== null && event.detail !== undefined && event.detail.text ) {
|
|
|
|
|
|
output = event.detail.text;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
console.log( 'Progress: ' + output );
|
|
|
document.getElementById( 'feedback' ).innerHTML = output;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
resizeDisplayGL: function () {
|
|
|
+
|
|
|
this.controls.handleResize();
|
|
|
|
|
|
this.recalcAspectRatio();
|
|
|
this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
|
|
|
|
|
|
this.updateCamera();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
recalcAspectRatio: function () {
|
|
|
+
|
|
|
this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
|
|
|
+
|
|
|
},
|
|
|
|
|
|
resetCamera: function () {
|
|
|
+
|
|
|
this.camera.position.copy( this.cameraDefaults.posCamera );
|
|
|
this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
|
|
|
|
|
|
this.updateCamera();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
updateCamera: function () {
|
|
|
+
|
|
|
this.camera.aspect = this.aspectRatio;
|
|
|
this.camera.lookAt( this.cameraTarget );
|
|
|
this.camera.updateProjectionMatrix();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
render: function () {
|
|
|
+
|
|
|
if ( ! this.renderer.autoClear ) this.renderer.clear();
|
|
|
|
|
|
this.controls.update();
|
|
@@ -375,43 +429,60 @@
|
|
|
this.cube.rotation.y += 0.05;
|
|
|
|
|
|
this.renderer.render( this.scene, this.camera );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
alterShading: function () {
|
|
|
- let scope = this;
|
|
|
+
|
|
|
+ const scope = this;
|
|
|
scope.flatShading = ! scope.flatShading;
|
|
|
- console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading');
|
|
|
+ console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading' );
|
|
|
|
|
|
scope.traversalFunction = function ( material ) {
|
|
|
+
|
|
|
material.flatShading = scope.flatShading;
|
|
|
material.needsUpdate = true;
|
|
|
+
|
|
|
};
|
|
|
- function scopeTraverse ( object3d ) {
|
|
|
+
|
|
|
+ function scopeTraverse( object3d ) {
|
|
|
+
|
|
|
scope.traverseScene( object3d );
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
scope.pivot.traverse( scopeTraverse );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
alterDouble: function () {
|
|
|
- let scope = this;
|
|
|
+
|
|
|
+ const scope = this;
|
|
|
scope.doubleSide = ! scope.doubleSide;
|
|
|
- console.log( scope.doubleSide ? 'Enabling THREE.DoubleSide materials' : 'Enabling THREE.FrontSide materials');
|
|
|
+ console.log( scope.doubleSide ? 'Enabling THREE.DoubleSide materials' : 'Enabling THREE.FrontSide materials' );
|
|
|
|
|
|
scope.traversalFunction = function ( material ) {
|
|
|
+
|
|
|
material.side = scope.doubleSide ? THREE.DoubleSide : THREE.FrontSide;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
- function scopeTraverse ( object3d ) {
|
|
|
+ function scopeTraverse( object3d ) {
|
|
|
+
|
|
|
scope.traverseScene( object3d );
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
scope.pivot.traverse( scopeTraverse );
|
|
|
+
|
|
|
},
|
|
|
|
|
|
traverseScene: function ( object3d ) {
|
|
|
+
|
|
|
if ( Array.isArray( object3d.material ) ) {
|
|
|
|
|
|
- let materials = object3d.material.materials;
|
|
|
- for ( let name in materials ) {
|
|
|
+ const materials = object3d.material.materials;
|
|
|
+ for ( const name in materials ) {
|
|
|
|
|
|
if ( materials.hasOwnProperty( name ) ) this.traversalFunction( materials[ name ] );
|
|
|
|
|
@@ -422,9 +493,11 @@
|
|
|
this.traversalFunction( object3d.material );
|
|
|
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
executeLoading: function () {
|
|
|
+
|
|
|
// Load a file with OBJLoader2.parse on main
|
|
|
this.useParseMain();
|
|
|
|
|
@@ -442,14 +515,14 @@
|
|
|
|
|
|
// Load a file with OBJLoader2Parallel.load in parallel in worker and add normals during onMeshAlter
|
|
|
this.useLoadParallelMeshAlter();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
- let app = new WWOBJLoader2Example( document.getElementById( 'example' ) );
|
|
|
+ const app = new WWOBJLoader2Example( document.getElementById( 'example' ) );
|
|
|
|
|
|
- let handleExecuteLoading;
|
|
|
- let wwObjLoader2Control = {
|
|
|
+ const wwObjLoader2Control = {
|
|
|
flatShading: app.flatShading,
|
|
|
doubleSide: app.doubleSide,
|
|
|
useJsmWorker: app.useJsmWorker,
|
|
@@ -465,7 +538,7 @@
|
|
|
elementHandle.domElement.parentElement.style.opacity = 0.5;
|
|
|
|
|
|
},
|
|
|
- executeLoading: function() {
|
|
|
+ executeLoading: function () {
|
|
|
|
|
|
app.executeLoading();
|
|
|
this.disableElement( handleExecuteLoading );
|
|
@@ -473,34 +546,40 @@
|
|
|
},
|
|
|
};
|
|
|
|
|
|
- let menuDiv = document.getElementById( 'dat' );
|
|
|
- let gui = new GUI( {
|
|
|
+ const menuDiv = document.getElementById( 'dat' );
|
|
|
+ const gui = new GUI( {
|
|
|
autoPlace: false,
|
|
|
width: 320
|
|
|
} );
|
|
|
menuDiv.appendChild( gui.domElement );
|
|
|
|
|
|
- let folderRenderingOptions = gui.addFolder( 'Rendering Options' );
|
|
|
- let controlFlat = folderRenderingOptions.add( wwObjLoader2Control, 'flatShading' ).name( 'Flat Shading' );
|
|
|
- controlFlat.onChange( function( value ) {
|
|
|
+ const folderRenderingOptions = gui.addFolder( 'Rendering Options' );
|
|
|
+ const controlFlat = folderRenderingOptions.add( wwObjLoader2Control, 'flatShading' ).name( 'Flat Shading' );
|
|
|
+ controlFlat.onChange( function ( value ) {
|
|
|
+
|
|
|
console.log( 'Setting flatShading to: ' + value );
|
|
|
app.alterShading();
|
|
|
- });
|
|
|
|
|
|
- let controlDouble = folderRenderingOptions.add( wwObjLoader2Control, 'doubleSide' ).name( 'Double Side Materials' );
|
|
|
- controlDouble.onChange( function( value ) {
|
|
|
+ } );
|
|
|
+
|
|
|
+ const controlDouble = folderRenderingOptions.add( wwObjLoader2Control, 'doubleSide' ).name( 'Double Side Materials' );
|
|
|
+ controlDouble.onChange( function ( value ) {
|
|
|
+
|
|
|
console.log( 'Setting doubleSide to: ' + value );
|
|
|
app.alterDouble();
|
|
|
- });
|
|
|
|
|
|
- let folderObjLoader2ParallelOptions = gui.addFolder( 'OBJLoader2Parallel Options' );
|
|
|
- let controlJsmWorker = folderObjLoader2ParallelOptions.add( wwObjLoader2Control, 'useJsmWorker' ).name( 'Use Module Workers' );
|
|
|
- controlJsmWorker.onChange( function( value ) {
|
|
|
+ } );
|
|
|
+
|
|
|
+ const folderObjLoader2ParallelOptions = gui.addFolder( 'OBJLoader2Parallel Options' );
|
|
|
+ const controlJsmWorker = folderObjLoader2ParallelOptions.add( wwObjLoader2Control, 'useJsmWorker' ).name( 'Use Module Workers' );
|
|
|
+ controlJsmWorker.onChange( function ( value ) {
|
|
|
+
|
|
|
console.log( 'Setting useJsmWorker to: ' + value );
|
|
|
app.useJsmWorker = value;
|
|
|
- });
|
|
|
- let folderExecution = gui.addFolder( 'Execution' );
|
|
|
- handleExecuteLoading = folderExecution.add( wwObjLoader2Control, 'executeLoading' ).name( 'Run' );
|
|
|
+
|
|
|
+ } );
|
|
|
+ const folderExecution = gui.addFolder( 'Execution' );
|
|
|
+ const handleExecuteLoading = folderExecution.add( wwObjLoader2Control, 'executeLoading' ).name( 'Run' );
|
|
|
handleExecuteLoading.domElement.id = 'startButton';
|
|
|
folderRenderingOptions.open();
|
|
|
folderObjLoader2ParallelOptions.open();
|
|
@@ -508,14 +587,19 @@
|
|
|
|
|
|
|
|
|
// init three.js example application
|
|
|
- function resizeWindow () {
|
|
|
+ function resizeWindow() {
|
|
|
+
|
|
|
app.resizeDisplayGL();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- function render () {
|
|
|
+ function render() {
|
|
|
+
|
|
|
requestAnimationFrame( render );
|
|
|
app.render();
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
window.addEventListener( 'resize', resizeWindow, false );
|
|
|
|
|
|
console.log( 'Starting initialisation phase...' );
|