diff --git a/examples/jsm/loaders/3DMLoader.js b/examples/jsm/loaders/3DMLoader.js index 5007555efb63ef..af3ba979750c60 100644 --- a/examples/jsm/loaders/3DMLoader.js +++ b/examples/jsm/loaders/3DMLoader.js @@ -587,7 +587,6 @@ Rhino3dmLoader.Rhino3dmWorker = function () { var views = []; var namedViews = []; var groups = []; - var strings = []; //Handle objects @@ -780,7 +779,7 @@ Rhino3dmLoader.Rhino3dmWorker = function () { position.type = 'Float32Array'; position.array = [ pt[ 0 ], pt[ 1 ], pt[ 2 ] ]; - _color = _attributes.drawColor( doc ); + var _color = _attributes.drawColor( doc ); color.itemSize = 3; color.type = 'Float32Array'; @@ -918,28 +917,28 @@ Rhino3dmLoader.Rhino3dmWorker = function () { if ( curve instanceof rhino.LineCurve ) { - return [ curve.pointAtStart, curve.pointAtEnd ]; + return [ curve.pointAtStart, curve.pointAtEnd ]; } if ( curve instanceof rhino.PolylineCurve ) { - pointCount = curve.pointCount; - for ( var i = 0; i < pointCount; i ++ ) { + pointCount = curve.pointCount; + for ( var i = 0; i < pointCount; i ++ ) { rc.push( curve.point( i ) ); - } + } - return rc; + return rc; } if ( curve instanceof rhino.PolyCurve ) { - var segmentCount = curve.segmentCount; + var segmentCount = curve.segmentCount; - for ( var i = 0; i < segmentCount; i ++ ) { + for ( var i = 0; i < segmentCount; i ++ ) { var segment = curve.segmentCurve( i ); var segmentArray = curveToPoints( segment ); @@ -948,13 +947,13 @@ Rhino3dmLoader.Rhino3dmWorker = function () { } - return rc; + return rc; } if ( curve instanceof rhino.NurbsCurve && curve.degree === 1 ) { - // console.info( 'degree 1 curve' ); + // console.info( 'degree 1 curve' ); } @@ -970,34 +969,35 @@ Rhino3dmLoader.Rhino3dmWorker = function () { ts.push( t ); continue; - } + } - var tan = curve.tangentAt( t ); - var prevTan = curve.tangentAt( ts.slice( - 1 )[ 0 ] ); + var tan = curve.tangentAt( t ); + var prevTan = curve.tangentAt( ts.slice( - 1 )[ 0 ] ); - // Duplicaated from THREE.Vector3 - // How to pass imports to worker? + // Duplicaated from THREE.Vector3 + // How to pass imports to worker? - tS = tan[ 0 ] * tan[ 0 ] + tan[ 1 ] * tan[ 1 ] + tan[ 2 ] * tan[ 2 ]; - ptS = prevTan[ 0 ] * prevTan[ 0 ] + prevTan[ 1 ] * prevTan[ 1 ] + prevTan[ 2 ] * prevTan[ 2 ]; + var tS = tan[ 0 ] * tan[ 0 ] + tan[ 1 ] * tan[ 1 ] + tan[ 2 ] * tan[ 2 ]; + var ptS = prevTan[ 0 ] * prevTan[ 0 ] + prevTan[ 1 ] * prevTan[ 1 ] + prevTan[ 2 ] * prevTan[ 2 ]; - var denominator = Math.sqrt( tS * ptS ); + var denominator = Math.sqrt( tS * ptS ); - var angle; + var angle; - if ( denominator === 0 ) { + if ( denominator === 0 ) { angle = Math.PI / 2; - } else { + } else { var theta = ( tan.x * prevTan.x + tan.y * prevTan.y + tan.z * prevTan.z ) / denominator; angle = Math.acos( Math.max( - 1, Math.min( 1, theta ) ) ); - } + } + + if ( angle < 0.1 ) continue; - if ( angle < 0.1 ) continue; - ts.push( t ); + ts.push( t ); } diff --git a/examples/jsm/loaders/VOXLoader.js b/examples/jsm/loaders/VOXLoader.js index df507b77b2140c..fa52dc5409eccb 100644 --- a/examples/jsm/loaders/VOXLoader.js +++ b/examples/jsm/loaders/VOXLoader.js @@ -112,7 +112,7 @@ VOXLoader.prototype = Object.assign( Object.create( Loader.prototype ), { } const chunkSize = data.getInt32( i, true ); i += 4; - const childChunks = data.getInt32( i, true ); i += 4; + data.getInt32( i, true ); i += 4; // childChunks if ( id === 'SIZE' ) { diff --git a/examples/webgl_loader_3dm.html b/examples/webgl_loader_3dm.html index 058e5738ddff26..335ea160df96ee 100644 --- a/examples/webgl_loader_3dm.html +++ b/examples/webgl_loader_3dm.html @@ -53,7 +53,6 @@ loader.load( 'models/3dm/Rhino_Logo.3dm', function ( object ) { - console.log( object ); scene.add( object ); initGUI( object.userData.layers ); @@ -124,7 +123,7 @@ var layerName = layers[ child.userData.attributes.layerIndex ].name; if ( layerName === name ) { - + child.visible = val; layer.visible = val; diff --git a/examples/webgl_loader_vox.html b/examples/webgl_loader_vox.html index 4513cae950a69f..05aec7ae47d029 100644 --- a/examples/webgl_loader_vox.html +++ b/examples/webgl_loader_vox.html @@ -109,34 +109,34 @@ } - function displayPalette( palette ) { - - const canvas = document.createElement( 'canvas' ); - canvas.width = 8; - canvas.height = 32; - canvas.style.position = 'absolute'; - canvas.style.top = '0'; - canvas.style.width = 100 + 'px'; - canvas.style.imageRendering = 'pixelated'; - document.body.appendChild( canvas ); - - const context = canvas.getContext( '2d' ); - - for ( var c = 0; c < 256; c ++ ) { - - const x = c % 8; - const y = Math.floor( c / 8 ); - - const hex = palette[ c + 1 ]; - const r = hex >> 0 & 0xff; - const g = hex >> 8 & 0xff; - const b = hex >> 16 & 0xff; - context.fillStyle = `rgba(${r},${g},${b},1)`; - context.fillRect( x, 31 - y, 1, 1 ); - - } - - } + // function displayPalette( palette ) { + // + // const canvas = document.createElement( 'canvas' ); + // canvas.width = 8; + // canvas.height = 32; + // canvas.style.position = 'absolute'; + // canvas.style.top = '0'; + // canvas.style.width = 100 + 'px'; + // canvas.style.imageRendering = 'pixelated'; + // document.body.appendChild( canvas ); + // + // const context = canvas.getContext( '2d' ); + // + // for ( var c = 0; c < 256; c ++ ) { + // + // const x = c % 8; + // const y = Math.floor( c / 8 ); + // + // const hex = palette[ c + 1 ]; + // const r = hex >> 0 & 0xff; + // const g = hex >> 8 & 0xff; + // const b = hex >> 16 & 0xff; + // context.fillStyle = `rgba(${r},${g},${b},1)`; + // context.fillRect( x, 31 - y, 1, 1 ); + // + // } + // + // } function onWindowResize() { diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 11ad6d60257f71..01a32456e2262a 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -295,7 +295,7 @@ function WebGLRenderer( parameters ) { objects = new WebGLObjects( _gl, geometries, attributes, info ); morphtargets = new WebGLMorphtargets( _gl ); programCache = new WebGLPrograms( _this, cubemaps, extensions, capabilities, bindingStates ); - materials = new WebGLMaterials( properties, cubemaps ); + materials = new WebGLMaterials( properties ); renderLists = new WebGLRenderLists( properties ); renderStates = new WebGLRenderStates();