language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
mrdoob
three.js
a37b30695a59e28adeaa4e56bbce3ff7156a07d0.json
Fix LensFlarePlugin example on Firefox On Firefox (windows), the LensFlare example does not show any lens flare since at least r71. Chrome and IE are okay. The plugin can be fixed by unbinding a texture slot.
src/renderers/webgl/plugins/LensFlarePlugin.js
@@ -346,6 +346,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) { // save current RGB to temp texture + renderer.state.activeTexture( gl.TEXTURE0 ); + renderer.state.bindTexture( gl.TEXTURE_2D, null ); renderer.state.activeTexture( gl.TEXTURE1 ); renderer.state.bindTexture( gl.TEXTURE_2D, tempTexture ); gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );
false
Other
mrdoob
three.js
c24062abdc971921d6eb37fd451da9f825f4d65f.json
Convert space indentation to tab indentation.
examples/webgl_postprocessing_ssao.html
@@ -7,216 +7,216 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere--> <html lang="en"> - <head> - <title>three.js webgl - postprocessing - Screen Space Ambient Occlusion</title> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> - <style> - body { - background-color: #000000; - margin: 0px; - overflow: hidden; - font-family:Monospace; - font-size:13px; - text-align:center; - font-weight: bold; - } - - a { - color:#0078ff; - } - - #info { - color:#fff; - position: relative; - top: 0px; - width: 50em; - margin: 0 auto -2.1em; - padding: 5px; - z-index:100; - } - </style> - </head> - <body> - <script src="../build/three.js"></script> - <script src="js/shaders/SSAOShader.js"></script> - <script src="js/Detector.js"></script> - <script src="js/libs/stats.min.js"></script> - <script src='js/libs/dat.gui.min.js'></script> - - <div id="info"> - <a href="http://threejs.org" target="_blank">three.js</a> - webgl screen space ambient occlusion example - - shader by <a href="http://alteredqualia.com">alteredq</a> - </div> - - <script> - - if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); - - var container, stats; - var camera, scene, renderer, - depthMaterial; - var group; - var depthScale = 1.0; - var height = window.innerHeight; - var postprocessing = { enabled : true, renderMode: 0 }; // renderMode: 0('framebuffer'), 1('onlyAO') - - init(); - animate(); - - function init() { - - container = document.createElement( 'div' ); - document.body.appendChild( container ); - - renderer = new THREE.WebGLRenderer( { antialias: false } ); - renderer.setClearColor( 0xa0a0a0 ); - - renderer.setSize( window.innerWidth, window.innerHeight ); - document.body.appendChild( renderer.domElement ); - var depthShader = THREE.ShaderLib[ "depthRGBA" ]; - var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); - - depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, - uniforms: depthUniforms, blending: THREE.NoBlending } ); - - camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 100, 700 ); - camera.position.z = 500; - - scene = new THREE.Scene(); - - group = new THREE.Object3D(); - scene.add( group ); - - var geometry = new THREE.IcosahedronGeometry( 5, 1 ); - for ( var i = 0; i < 200; i ++ ) { - - var material = new THREE.MeshBasicMaterial(); - material.color.r = Math.random(); - material.color.g = Math.random(); - material.color.b = Math.random(); - - var mesh = new THREE.Mesh( geometry, material ); - mesh.position.x = Math.random() * 400 - 200; - mesh.position.y = Math.random() * 400 - 200; - mesh.position.z = Math.random() * 400 - 200; - mesh.rotation.x = Math.random(); - mesh.rotation.y = Math.random(); - mesh.rotation.z = Math.random(); - - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 10 + 1; - group.add( mesh ); - } - - stats = new Stats(); - stats.domElement.style.position = 'absolute'; - stats.domElement.style.top = '0px'; - container.appendChild( stats.domElement ); - - // postprocessing - initPostprocessing(); - - // Init gui - var gui = new dat.GUI(); - gui.add( postprocessing, "enabled" ).onChange(); - gui.add( postprocessing, "renderMode", { framebuffer: 0, onlyAO: 1 } ).onChange( renderModeChange ).listen(); - - window.addEventListener( 'resize', onWindowResize, false ); - } - - function renderModeChange( value ) { - - if ( value == 0 ) { // framebuffer - postprocessing.ssao_uniforms[ 'onlyAO' ].value = false; - } else if ( value == 1 ) { // onlyAO - postprocessing.ssao_uniforms[ 'onlyAO' ].value = true; - } else { - console.error( "Not define renderModeChange type: " + value ); - } - } - - function onWindowResize() { - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize( window.innerWidth, window.innerHeight ); - - initPostprocessing(); - } - - function initPostprocessing() { - - postprocessing.scene = new THREE.Scene(); - postprocessing.camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -1000, 1000 ); - postprocessing.camera.position.z = 1; - - postprocessing.scene.add( postprocessing.camera ); - - var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter }; - postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth * depthScale, height * depthScale, pars ); - postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, height, pars ); - - // Setup SSAO material - var ssao_shader = THREE.SSAOShader; - postprocessing.ssao_uniforms = THREE.UniformsUtils.clone( ssao_shader.uniforms ); - postprocessing.ssao_uniforms[ "tDiffuse" ].value = postprocessing.rtTextureColor; - postprocessing.ssao_uniforms[ "tDepth" ].value = postprocessing.rtTextureDepth; - postprocessing.ssao_uniforms[ 'size' ].value.set( window.innerWidth*depthScale, window.innerHeight*depthScale ); - postprocessing.ssao_uniforms[ 'cameraNear' ].value = camera.near; - postprocessing.ssao_uniforms[ 'cameraFar' ].value = camera.far; - postprocessing.ssao_uniforms[ 'onlyAO' ].value = ( postprocessing.renderMode == 1 ); - - postprocessing.materialSSAO = new THREE.ShaderMaterial( { - - uniforms: postprocessing.ssao_uniforms, - vertexShader: ssao_shader.vertexShader, - fragmentShader: ssao_shader.fragmentShader - }); - - postprocessing.ssaoQuad = new THREE.Mesh( new THREE.PlaneBufferGeometry( window.innerWidth, window.innerHeight ), postprocessing.materialSSAO ); - postprocessing.ssaoQuad.position.z = -500; - postprocessing.scene.add( postprocessing.ssaoQuad ); - } - - function shaderUpdate() { - postprocessing.materialSSAO.needsUpdate = true; - } - - function animate() { - requestAnimationFrame( animate ); - - render(); - stats.update(); - } - - function render() { - var timer = performance.now(); - group.rotation.x = timer * 0.0002; - group.rotation.y = timer * 0.0001; - - if ( postprocessing.enabled ) { - - renderer.clear(); - - // Render scene into texture - scene.overrideMaterial = null; - renderer.render( scene, camera, postprocessing.rtTextureColor , true ); - - // Render depth into texture - scene.overrideMaterial = depthMaterial; - renderer.render( scene, camera, postprocessing.rtTextureDepth, true ); - - // Render SSAO composite - renderer.render( postprocessing.scene, postprocessing.camera ); - - } else { - - scene.overrideMaterial = null; - renderer.clear(); - renderer.render( scene, camera ); - } - } - - </script> - </body> + <head> + <title>three.js webgl - postprocessing - Screen Space Ambient Occlusion</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> + <style> + body { + background-color: #000000; + margin: 0px; + overflow: hidden; + font-family:Monospace; + font-size:13px; + text-align:center; + font-weight: bold; + } + + a { + color:#0078ff; + } + + #info { + color:#fff; + position: relative; + top: 0px; + width: 50em; + margin: 0 auto -2.1em; + padding: 5px; + z-index:100; + } + </style> + </head> + <body> + <script src="../build/three.js"></script> + <script src="js/shaders/SSAOShader.js"></script> + <script src="js/Detector.js"></script> + <script src="js/libs/stats.min.js"></script> + <script src='js/libs/dat.gui.min.js'></script> + + <div id="info"> + <a href="http://threejs.org" target="_blank">three.js</a> - webgl screen space ambient occlusion example - + shader by <a href="http://alteredqualia.com">alteredq</a> + </div> + + <script> + + if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); + + var container, stats; + var camera, scene, renderer, + depthMaterial; + var group; + var depthScale = 1.0; + var height = window.innerHeight; + var postprocessing = { enabled : true, renderMode: 0 }; // renderMode: 0('framebuffer'), 1('onlyAO') + + init(); + animate(); + + function init() { + + container = document.createElement( 'div' ); + document.body.appendChild( container ); + + renderer = new THREE.WebGLRenderer( { antialias: false } ); + renderer.setClearColor( 0xa0a0a0 ); + + renderer.setSize( window.innerWidth, window.innerHeight ); + document.body.appendChild( renderer.domElement ); + var depthShader = THREE.ShaderLib[ "depthRGBA" ]; + var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); + + depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, + uniforms: depthUniforms, blending: THREE.NoBlending } ); + + camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 100, 700 ); + camera.position.z = 500; + + scene = new THREE.Scene(); + + group = new THREE.Object3D(); + scene.add( group ); + + var geometry = new THREE.IcosahedronGeometry( 5, 1 ); + for ( var i = 0; i < 200; i ++ ) { + + var material = new THREE.MeshBasicMaterial(); + material.color.r = Math.random(); + material.color.g = Math.random(); + material.color.b = Math.random(); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.position.x = Math.random() * 400 - 200; + mesh.position.y = Math.random() * 400 - 200; + mesh.position.z = Math.random() * 400 - 200; + mesh.rotation.x = Math.random(); + mesh.rotation.y = Math.random(); + mesh.rotation.z = Math.random(); + + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 10 + 1; + group.add( mesh ); + } + + stats = new Stats(); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.top = '0px'; + container.appendChild( stats.domElement ); + + // postprocessing + initPostprocessing(); + + // Init gui + var gui = new dat.GUI(); + gui.add( postprocessing, "enabled" ).onChange(); + gui.add( postprocessing, "renderMode", { framebuffer: 0, onlyAO: 1 } ).onChange( renderModeChange ).listen(); + + window.addEventListener( 'resize', onWindowResize, false ); + } + + function renderModeChange( value ) { + + if ( value == 0 ) { // framebuffer + postprocessing.ssao_uniforms[ 'onlyAO' ].value = false; + } else if ( value == 1 ) { // onlyAO + postprocessing.ssao_uniforms[ 'onlyAO' ].value = true; + } else { + console.error( "Not define renderModeChange type: " + value ); + } + } + + function onWindowResize() { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize( window.innerWidth, window.innerHeight ); + + initPostprocessing(); + } + + function initPostprocessing() { + + postprocessing.scene = new THREE.Scene(); + postprocessing.camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -1000, 1000 ); + postprocessing.camera.position.z = 1; + + postprocessing.scene.add( postprocessing.camera ); + + var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter }; + postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth * depthScale, height * depthScale, pars ); + postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, height, pars ); + + // Setup SSAO material + var ssao_shader = THREE.SSAOShader; + postprocessing.ssao_uniforms = THREE.UniformsUtils.clone( ssao_shader.uniforms ); + postprocessing.ssao_uniforms[ "tDiffuse" ].value = postprocessing.rtTextureColor; + postprocessing.ssao_uniforms[ "tDepth" ].value = postprocessing.rtTextureDepth; + postprocessing.ssao_uniforms[ 'size' ].value.set( window.innerWidth*depthScale, window.innerHeight*depthScale ); + postprocessing.ssao_uniforms[ 'cameraNear' ].value = camera.near; + postprocessing.ssao_uniforms[ 'cameraFar' ].value = camera.far; + postprocessing.ssao_uniforms[ 'onlyAO' ].value = ( postprocessing.renderMode == 1 ); + + postprocessing.materialSSAO = new THREE.ShaderMaterial( { + + uniforms: postprocessing.ssao_uniforms, + vertexShader: ssao_shader.vertexShader, + fragmentShader: ssao_shader.fragmentShader + }); + + postprocessing.ssaoQuad = new THREE.Mesh( new THREE.PlaneBufferGeometry( window.innerWidth, window.innerHeight ), postprocessing.materialSSAO ); + postprocessing.ssaoQuad.position.z = -500; + postprocessing.scene.add( postprocessing.ssaoQuad ); + } + + function shaderUpdate() { + postprocessing.materialSSAO.needsUpdate = true; + } + + function animate() { + requestAnimationFrame( animate ); + + render(); + stats.update(); + } + + function render() { + var timer = performance.now(); + group.rotation.x = timer * 0.0002; + group.rotation.y = timer * 0.0001; + + if ( postprocessing.enabled ) { + + renderer.clear(); + + // Render scene into texture + scene.overrideMaterial = null; + renderer.render( scene, camera, postprocessing.rtTextureColor , true ); + + // Render depth into texture + scene.overrideMaterial = depthMaterial; + renderer.render( scene, camera, postprocessing.rtTextureDepth, true ); + + // Render SSAO composite + renderer.render( postprocessing.scene, postprocessing.camera ); + + } else { + + scene.overrideMaterial = null; + renderer.clear(); + renderer.render( scene, camera ); + } + } + + </script> + </body> </html> \ No newline at end of file
false
Other
mrdoob
three.js
2bfb1f557b7e39bda0656a5a65a4658fcfc7d50f.json
Solve the spaces vs tabs indentation issues.
examples/js/renderers/SoftwareRenderer.js
@@ -207,20 +207,20 @@ THREE.SoftwareRenderer = function ( parameters ) { } } else if ( element instanceof THREE.RenderableLine ) { - - var shader = getMaterialShader( material ); - - drawLine( - element.v1.positionScreen, - element.v2.positionScreen, - element.vertexColors[0], - element.vertexColors[1], - shader, - material - ); - } - - } + + var shader = getMaterialShader( material ); + + drawLine( + element.v1.positionScreen, + element.v2.positionScreen, + element.vertexColors[0], + element.vertexColors[1], + shader, + material + ); + } + + } finishClear();
false
Other
mrdoob
three.js
d72df15ca3528e80091d7c30e8815ee07efc440f.json
Add SSAO demo and give config GUI.
examples/webgl_postprocessing_ssao.html
@@ -0,0 +1,226 @@ +<!DOCTYPE html> + +<!--Reference: +SSAO algo: http://devlog-martinsh.blogspot.tw/2011/12/ssao-shader-update-v12.html?showComment=1398158188712#c1563204765906693531 +log depth http://outerra.blogspot.tw/2013/07/logarithmic-depth-buffer-optimizations.html +convert the exponential depth to a linear value: http://www.ozone3d.net/blogs/lab/20090206/how-to-linearize-the-depth-value/ +Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere--> + +<html lang="en"> + <head> + <title>three.js webgl - postprocessing - Screen Space Ambient Occlusion</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> + <style> + body { + background-color: #000000; + margin: 0px; + overflow: hidden; + font-family:Monospace; + font-size:13px; + text-align:center; + font-weight: bold; + } + + a { + color:#0078ff; + } + + #info { + color:#fff; + position: relative; + top: 0px; + width: 50em; + margin: 0 auto -2.1em; + padding: 5px; + z-index:100; + } + </style> + </head> + <body> + <script src="../build/three.js"></script> + <script src="js/shaders/SSAOShader.js"></script> + <script src="js/Detector.js"></script> + <script src="js/libs/stats.min.js"></script> + <script src='js/libs/dat.gui.min.js'></script> + + <div id="info"> + <a href="http://threejs.org" target="_blank">three.js</a> - webgl screen space ambient occlusion example - + shader by <a href="http://alteredqualia.com">alteredq</a> + </div> + + <script> + + if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); + + var container, stats; + var camera, scene, renderer, + depthMaterial; + var group; + var depthScale = 1.0; + var height = window.innerHeight; + var postprocessing = { enabled : true, renderMode: 'framebuffer' }; // renderMode: 'framebuffer', 'onlyAO' + + init(); + animate(); + + function init() { + + container = document.createElement( 'div' ); + document.body.appendChild( container ); + + renderer = new THREE.WebGLRenderer( { antialias: false } ); + renderer.setClearColor( 0xa0a0a0 ); + + renderer.setSize( window.innerWidth, window.innerHeight ); + document.body.appendChild( renderer.domElement ); + var depthShader = THREE.ShaderLib[ "depthRGBA" ]; + var depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms ); + + depthMaterial = new THREE.ShaderMaterial( { fragmentShader: depthShader.fragmentShader, vertexShader: depthShader.vertexShader, + uniforms: depthUniforms, blending: THREE.NoBlending } ); + + camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 100, 700 ); + camera.position.z = 500; + + scene = new THREE.Scene(); + + group = new THREE.Object3D(); + scene.add( group ); + + var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 ); + directionalLight.position.set( 2, 1.2, 10 ).normalize(); + scene.add( directionalLight ); + + var geometry = new THREE.SphereBufferGeometry(5, 100, 100); //new THREE.BoxGeometry( 10, 10, 10 ); + for ( var i = 0; i < 100; i ++ ) { + + //var material = new THREE.MeshLambertMaterial({color: 0xaa0000}); //new + var material = new THREE.MeshBasicMaterial(); + material.color.r = Math.random(); + material.color.g = Math.random(); + material.color.b = Math.random(); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.position.x = Math.random() * 400 - 200; + mesh.position.y = Math.random() * 400 - 200; + mesh.position.z = Math.random() * 400 - 200; + mesh.rotation.x = Math.random(); + mesh.rotation.y = Math.random(); + mesh.rotation.z = Math.random(); + + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 10 + 1; + group.add( mesh ); + } + + stats = new Stats(); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.top = '0px'; + container.appendChild( stats.domElement ); + + // postprocessing + initPostprocessing(); + + // Init gui + var gui = new dat.GUI(); + gui.add( postprocessing, "enabled" ).onChange(); + // gui.add( postprocessing, "type" ).onChange( postprocessChange ); + gui.add( postprocessing, "renderMode", { framebuffer: 0, onlyAO: 1 } ).onChange( renderModeChange ).listen(); + + window.addEventListener( 'resize', onWindowResize, false ); + } + + function renderModeChange( value ) { + + if ( value == 0 ) { // framebuffer + postprocessing.ssao_uniforms[ 'onlyAO' ].value = false; + } else if ( value == 1 ) { // onlyAO + postprocessing.ssao_uniforms[ 'onlyAO' ].value = true; + } else { + console.error( "Not define renderModeChange type: " + value ); + } + } + + function onWindowResize() { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize( window.innerWidth, window.innerHeight ); + } + + function initPostprocessing() { + + postprocessing.scene = new THREE.Scene(); + postprocessing.camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -1000, 1000 ); + postprocessing.camera.position.z = 1; + + postprocessing.scene.add( postprocessing.camera ); + + var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter }; + postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth * depthScale, height * depthScale, pars ); + postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, height, pars ); + + // Setup SSAO material + var ssao_shader = THREE.SSAOShader; + postprocessing.ssao_uniforms = THREE.UniformsUtils.clone( ssao_shader.uniforms ); + postprocessing.ssao_uniforms[ "tDiffuse" ].value = postprocessing.rtTextureColor; + postprocessing.ssao_uniforms[ "tDepth" ].value = postprocessing.rtTextureDepth; + postprocessing.ssao_uniforms[ 'size' ].value.set( window.innerWidth*depthScale, window.innerHeight*depthScale ); + postprocessing.ssao_uniforms[ 'cameraNear' ].value = camera.near; + postprocessing.ssao_uniforms[ 'cameraFar' ].value = camera.far; + postprocessing.ssao_uniforms[ 'onlyAO' ].value = false; + + postprocessing.materialSSAO = new THREE.ShaderMaterial( { + + uniforms: postprocessing.ssao_uniforms, + vertexShader: ssao_shader.vertexShader, + fragmentShader: ssao_shader.fragmentShader + }); + + postprocessing.ssaoQuad = new THREE.Mesh( new THREE.PlaneBufferGeometry( window.innerWidth, window.innerHeight ), postprocessing.materialSSAO ); + postprocessing.ssaoQuad.position.z = -500; + postprocessing.scene.add( postprocessing.ssaoQuad ); + } + + function shaderUpdate() { + postprocessing.materialSSAO.needsUpdate = true; + } + + function animate() { + requestAnimationFrame( animate ); + + render(); + stats.update(); + } + + function render() { + var timer = performance.now(); + group.rotation.x = timer * 0.0002; + group.rotation.y = timer * 0.0001; + + if ( postprocessing.enabled ) { + + renderer.clear(); + + // Render scene into texture + scene.overrideMaterial = null; + renderer.render( scene, camera, postprocessing.rtTextureColor , true ); + + // Render depth into texture + scene.overrideMaterial = depthMaterial; + renderer.render( scene, camera, postprocessing.rtTextureDepth, true ); + + // Render SSAO composite + renderer.render( postprocessing.scene, postprocessing.camera ); + + } else { + + scene.overrideMaterial = null; + renderer.clear(); + renderer.render( scene, camera ); + } + } + + </script> + </body> +</html> \ No newline at end of file
false
Other
mrdoob
three.js
d27c2aa3d2f9e61470e14268ee829f9474f76326.json
Fix 404 to CompressedTextureLoader.js CompressedTextureLoader is part of the main library since 6f06aa6 (r69). Fixes PVRTC example #5807. This example is only supported on iOS.
examples/webgl_materials_texture_pvrtc.html
@@ -37,7 +37,6 @@ </div> <script src="../build/three.min.js"></script> - <script src="js/loaders/CompressedTextureLoader.js"></script> <script src="js/loaders/PVRLoader.js"></script> <script src="js/Detector.js"></script>
false
Other
mrdoob
three.js
1736aa73baaeae99e778fcf2d44de3d1f1ab8959.json
Fix parallaxmap shader crash Fixes #5813.
examples/js/shaders/ParallaxShader.js
@@ -82,7 +82,9 @@ THREE.ParallaxShader = { "float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", // while ( heightFromTexture > currentLayerHeight ) - "for ( int i = 0; i == 0; i += 0 ) {", + // Infinite loops are not well supported. Do a "large" finite + // loop, but not too large, as it slows down some compilers. + "for ( int i = 0; i < 30; i += 1 ) {", "if ( heightFromTexture <= currentLayerHeight ) {", "break;", "}",
false
Other
mrdoob
three.js
dfaea63385328a89bc56f4f1f28e4dcaefdffbfe.json
delete all webglProperties on loss of context
src/renderers/WebGLRenderer.js
@@ -184,6 +184,8 @@ THREE.WebGLRenderer = function ( parameters ) { setDefaultGLState(); objects.objects = {}; + objects.webGLProps.deleteAll(); + webGLProps.deleteAll(); }, false);
true
Other
mrdoob
three.js
dfaea63385328a89bc56f4f1f28e4dcaefdffbfe.json
delete all webglProperties on loss of context
src/renderers/webgl/WebGLObjects.js
@@ -67,6 +67,7 @@ THREE.WebGLObjects = function ( gl, info ) { this.objects = objects; this.objectsImmediate = objectsImmediate; + this.webGLProps = webGLProps; this.geometries = geometries;
true
Other
mrdoob
three.js
dfaea63385328a89bc56f4f1f28e4dcaefdffbfe.json
delete all webglProperties on loss of context
src/renderers/webgl/WebGLProperties.js
@@ -6,6 +6,12 @@ THREE.WebGLProperties = function () { var properties = {}; + this.deleteAll = function () { + + properties = {}; + + } + this.delete = function ( object ) { delete properties[ object.uuid ];
true
Other
mrdoob
three.js
28ba50e8c9f146e54facc40147f2f75556528652.json
Initialize LensFlares rotation at 0 Probably a copy-paste error - it doesn't make sense to initialize rotation to 1.0 radians. Fixes #1124.
src/objects/LensFlare.js
@@ -39,15 +39,15 @@ THREE.LensFlare.prototype.add = function ( texture, size, distance, blending, co distance = Math.min( distance, Math.max( 0, distance ) ); this.lensFlares.push( { - texture: texture, // THREE.Texture - size: size, // size in pixels (-1 = use texture.width) - distance: distance, // distance (0-1) from light source (0=at light source) - x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is in front z = 1 is back - scale: 1, // scale - rotation: 1, // rotation - opacity: opacity, // opacity - color: color, // color - blending: blending // blending + texture: texture, // THREE.Texture + size: size, // size in pixels (-1 = use texture.width) + distance: distance, // distance (0-1) from light source (0=at light source) + x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is in front z = 1 is back + scale: 1, // scale + rotation: 0, // rotation + opacity: opacity, // opacity + color: color, // color + blending: blending // blending } ); };
false
Other
mrdoob
three.js
82a5a52b164137637908dd4a4eede6e7e7d703f7.json
return http request on load #6641
src/loaders/XHRLoader.js
@@ -65,6 +65,8 @@ THREE.XHRLoader.prototype = { scope.manager.itemStart( url ); + return request; + }, setResponseType: function ( value ) {
false
Other
mrdoob
three.js
3b55a8f4b84ef7edc0f80ab9d51e516c50b0c324.json
Add Multiple Elements example shows a solution to trying to draw lots of different HTML elements each with a different scene
examples/webgl_multiple_elements.html
@@ -0,0 +1,255 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>three.js webgl - multiple elements</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> + <style> + * { + box-sizing: border-box; + -moz-box-sizing: border-box; + } + + body { + color: #000; + font-family:Monospace; + font-size:13px; + + background-color: #fff; + margin: 0px; + } + + #info { + position: absolute; + top: 0px; width: 100%; + padding: 5px; + text-align:center; + } + + #content { + position: absolute; + top: 0px; width: 100%; + z-index: 1; + padding: 2em; + } + + a { + + color: #0080ff; + } + + #c { + position: fixed; + left: 0px; + width: 100%; + height: 100%; + } + + .list-item { + margin: 1em; + padding: 2em; + display: -webkit-flex; + display: flex; + flex-direction: row; + -webkit-flex-direction: row; + } + + .list-item .scene { + width: 200px; + height: 200px; + flex: 0 0 auto; + -webkit-flex: 0 0 auto; + } + .list-item .description { + font-family: sans-serif; + font-size: large; + padding-left: 2em; + flex: 1 1 auto; + -webkit-flex: 1 1 auto; + } + + @media only screen and (max-width : 600px) { + #content { + width: 100%; + } + .list-item { + margin: 0.5em; + padding: 0.5em; + flex-direction: column; + -webkit-flex-direction: column; + } + .list-item .description { + padding-left: 0em; + } + } + </style> + </head> + <body> + + <canvas id="c"></canvas> + <div id="content"> + <div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - multiple elements - webgl</div> + </div> + + <script src="../build/three.min.js"></script> + + <script src="js/Detector.js"></script> + + <script id="template" type="notjs"> + <div class="scene"></div> + <div class="description">some random text about this object, scene, whatever</div> + </script> + <script> + + if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); + + var canvas; + + var scenes = [], camera, renderer, emptyScene; + + init(); + animate(); + + function init() { + + canvas = document.getElementById( "c" ); + + camera = new THREE.PerspectiveCamera( 75, 1, 0.1, 100 ); + camera.position.z = 1.5; + + var geometries = [ + new THREE.BoxGeometry( 1, 1, 1 ), + new THREE.SphereGeometry( 0.5, 12, 12 ), + new THREE.DodecahedronGeometry( 0.5 ), + new THREE.CylinderGeometry( 0.5, 0.5, 1, 12 ), + ]; + + var template = document.getElementById("template").text; + var content = document.getElementById("content"); + + var emptyScene = new THREE.Scene(); + + var numScenes = 100; + + for ( var ii = 0; ii < numScenes; ++ii ) { + + var scene = new THREE.Scene(); + + // make a list item. + var element = document.createElement( "div" ); + element.innerHTML = template; + element.className = "list-item"; + + // Look up the element that represents the area + // we want to render the scene + scene.element = element.querySelector(".scene"); + content.appendChild(element); + + // add one random mesh to each scene + var geometry = geometries[ geometries.length * Math.random() | 0 ]; + var material = new THREE.MeshLambertMaterial( { color: randColor() } ); + + scene.add( new THREE.Mesh( geometry, material ) ); + + light = new THREE.DirectionalLight( 0xffffff ); + light.position.set( 0.5, 0.8, 1 ); + scene.add( light ); + + light = new THREE.DirectionalLight( 0xffffff ); + light.position.set( -0.5, -0.8, -1 ); + scene.add( light ); + + scenes.push( scene ); + } + + + renderer = new THREE.WebGLRenderer( { canvas: canvas, antialias: true } ); + renderer.setClearColor( 0xFFFFFF ); + + } + + function updateSize() { + + var width = canvas.clientWidth; + var height = canvas.clientHeight; + + if ( canvas.width !== width || canvas.height != height ) { + + renderer.setSize ( width, height, false ); + + } + + } + + function animate() { + + render(); + + requestAnimationFrame( animate ); + } + + function render() { + + updateSize(); + + renderer.setClearColor( 0xFFFFFF ); + renderer.clear( true ); + renderer.setClearColor( 0xE0E0E0 ); + + renderer.enableScissorTest( true ); + scenes.forEach( function( scene ) { + // so something moves + scene.children[0].rotation.x = Date.now() * 0.00111; + scene.children[0].rotation.z = Date.now() * 0.001; + + // get the element that is a place holder for where we want to + // draw the scene + var element = scene.element; + + // get its position relative to the page's viewport + var rect = element.getBoundingClientRect(); + + // check if it's offscreen. If so skip it + if ( rect.bottom < 0 || rect.top > renderer.domElement.clientHeight || + rect.right < 0 || rect.left > renderer.domElement.clientWidth ) { + return; // it's off screen + } + + // set the viewport + var width = rect.right - rect.left; + var height = rect.bottom - rect.top; + var left = rect.left; + var bottom = renderer.domElement.clientHeight - rect.bottom; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + renderer.setViewport( left, bottom, width, height ); + renderer.setScissor( left, bottom, width, height ); + renderer.render( scene, camera ); + + } ); + renderer.enableScissorTest( false ); + + } + + function rand( min, max ) { + if ( max == undefined ) { + max = min; + min = 0; + } + + return Math.random() * ( max - min ) + min; + } + + function randColor() { + var colors = [ rand( 256 ), rand ( 256 ), rand( 256 ) ]; + colors[ Math.random() * 3 | 0 ] = 255; + return ( colors[0] << 16 ) | + ( colors[1] << 8 ) | + ( colors[2] << 0 ) ; + } + + </script> + + </body> +</html>
false
Other
mrdoob
three.js
8ec4c81295e55477e22e57ed904c9e1e9a0faa78.json
Add default up direction
docs/api/core/Object3D.html
@@ -66,7 +66,7 @@ <h3>[property:Vector3 scale]</h3> <h3>[property:Vector3 up]</h3> <div> - Up direction. + Up direction. Default is THREE.Vector3( 0, 1, 0 ). </div> <h3>[property:Matrix4 matrix]</h3>
false
Other
mrdoob
three.js
c49dcddcdbde8c6fe5ead6ae19dd70c7bb6ce6b1.json
Copy BufferGeo to self or InstancedGeo
src/core/BufferGeometry.js
@@ -1209,6 +1209,33 @@ THREE.BufferGeometry.prototype = { return geometry; }, + + copy: function ( geometry ) { + + for ( var attr in geometry.attributes ) { + + var sourceAttr = geometry.attributes[attr]; + this.addAttribute( attr, sourceAttr.clone() ); + + } + + for ( var i = 0, il = geometry.offsets.length; i < il; i++ ) { + + var offset = geometry.offsets[i]; + + this.offsets.push( { + + start: offset.start, + index: offset.index, + count: offset.count + + } ); + + } + + return this; + + }, dispose: function () {
false
Other
mrdoob
three.js
dd538fe64944d8df18f970b7a23a55ca88848129.json
Add missing ;
src/extras/FontUtils.js
@@ -466,8 +466,8 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) { // To use the typeface.js face files, hook up the API var typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace }; if ( typeof self !== 'undefined' ){ - self._typeface_js = typeface_js + self._typeface_js = typeface_js; } -THREE.typeface_js = typeface_js +THREE.typeface_js = typeface_js;
false
Other
mrdoob
three.js
99d4757bd40d5ceb54aed67c64d87405cddb4d5c.json
Add NPM support
.npmignore
@@ -0,0 +1,6 @@ +examples/ +src/ +test/ +utils/ +docs/ +editor/
true
Other
mrdoob
three.js
99d4757bd40d5ceb54aed67c64d87405cddb4d5c.json
Add NPM support
package.json
@@ -0,0 +1,30 @@ +{ + "name": "three.js", + "version": "0.71.0", + "description": "JavaScript 3D library", + "main": "build/three.js", + "directories": { + "doc": "docs", + "example": "examples", + "test": "test" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/mrdoob/three.js" + }, + "keywords": [ + "three", + "three.js", + "3d", + "webgl" + ], + "author": "mrdoob", + "license": "MIT", + "bugs": { + "url": "https://github.com/mrdoob/three.js/issues" + }, + "homepage": "http://threejs.org/" +}
true
Other
mrdoob
three.js
e80b396b90af872ff91e6f609b7c340dea111f97.json
Update skeleton in existing loop
src/renderers/WebGLRenderer.js
@@ -1635,18 +1635,6 @@ THREE.WebGLRenderer = function ( parameters ) { if ( camera.parent === undefined ) camera.updateMatrixWorld(); - // update Skeleton objects - - scene.traverse( function ( object ) { - - if ( object instanceof THREE.SkinnedMesh ) { - - object.skeleton.update(); - - } - - } ); - camera.matrixWorldInverse.getInverse( camera.matrixWorld ); _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); @@ -1763,6 +1751,13 @@ THREE.WebGLRenderer = function ( parameters ) { } else { + // update Skeleton objects + if ( object instanceof THREE.SkinnedMesh ) { + + object.skeleton.update(); + + } + objects.init( object ); if ( object instanceof THREE.Light ) {
false
Other
mrdoob
three.js
b46f98d52634bc234380fd654c633f3afda5eabb.json
Remove additional update
src/renderers/WebGLRenderer.js
@@ -987,8 +987,6 @@ THREE.WebGLRenderer = function ( parameters ) { if ( material.visible === false ) return; - objects.update( object ); - var program = setProgram( camera, lights, fog, material, object ); var updateBuffers = false,
false
Other
mrdoob
three.js
77c7364298361a55deae254e185f1a083e7826be.json
Remove redundant texture binds Cache currently bound and active textures and move texture binds to WebGLState
src/renderers/WebGLRenderer.js
@@ -3351,8 +3351,8 @@ THREE.WebGLRenderer = function ( parameters ) { } - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); @@ -3469,8 +3469,8 @@ THREE.WebGLRenderer = function ( parameters ) { } - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); }; @@ -3516,8 +3516,8 @@ THREE.WebGLRenderer = function ( parameters ) { } - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); @@ -3605,8 +3605,8 @@ THREE.WebGLRenderer = function ( parameters ) { } else { - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube ); } @@ -3616,8 +3616,8 @@ THREE.WebGLRenderer = function ( parameters ) { function setCubeTextureDynamic ( texture, slot ) { - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture ); + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture ); } @@ -3684,7 +3684,8 @@ THREE.WebGLRenderer = function ( parameters ) { renderTarget.__webglFramebuffer = []; renderTarget.__webglRenderbuffer = []; - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); + setTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget, isTargetPowerOfTwo ); for ( var i = 0; i < 6; i ++ ) { @@ -3715,7 +3716,7 @@ THREE.WebGLRenderer = function ( parameters ) { } - _gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); + state.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); setTextureParameters( _gl.TEXTURE_2D, renderTarget, isTargetPowerOfTwo ); _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null ); @@ -3748,11 +3749,11 @@ THREE.WebGLRenderer = function ( parameters ) { if ( isCube ) { - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); } else { - _gl.bindTexture( _gl.TEXTURE_2D, null ); + state.bindTexture( _gl.TEXTURE_2D, null ); } @@ -3859,15 +3860,15 @@ THREE.WebGLRenderer = function ( parameters ) { if ( renderTarget instanceof THREE.WebGLRenderTargetCube ) { - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture ); _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP ); - _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); + state.bindTexture( _gl.TEXTURE_CUBE_MAP, null ); } else { - _gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); + state.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture ); _gl.generateMipmap( _gl.TEXTURE_2D ); - _gl.bindTexture( _gl.TEXTURE_2D, null ); + state.bindTexture( _gl.TEXTURE_2D, null ); }
true
Other
mrdoob
three.js
77c7364298361a55deae254e185f1a083e7826be.json
Remove redundant texture binds Cache currently bound and active textures and move texture binds to WebGLState
src/renderers/webgl/WebGLState.js
@@ -4,6 +4,8 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) { + var _this = this; + var newAttributes = new Uint8Array( 16 ); var enabledAttributes = new Uint8Array( 16 ); @@ -30,6 +32,11 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) { var currentPolygonOffsetFactor = null; var currentPolygonOffsetUnits = null; + var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS ); + + var currentTextureSlot = undefined; + var currentBoundTextures = {}; + this.initAttributes = function () { for ( var i = 0, l = newAttributes.length; i < l; i ++ ) { @@ -339,6 +346,47 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) { }; + this.activeTexture = function ( webglSlot ) { + + if ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1; + + if ( currentTextureSlot !== webglSlot ) { + + gl.activeTexture( webglSlot ); + currentTextureSlot = webglSlot; + + } + + } + + this.bindTexture = function ( webglType, webglTexture ) { + + if ( currentTextureSlot === undefined ) { + + _this.activeTexture(); + + } + + var boundTexture = currentBoundTextures[currentTextureSlot]; + + if ( boundTexture === undefined ) { + + boundTexture = { type: undefined, texture: undefined }; + currentBoundTextures[currentTextureSlot] = boundTexture; + + } + + if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) { + + gl.bindTexture( webglType, webglTexture ); + + boundTexture.type = webglType; + boundTexture.texture = webglTexture; + + } + + } + this.reset = function () { for ( var i = 0; i < enabledAttributes.length; i ++ ) {
true
Other
mrdoob
three.js
77c7364298361a55deae254e185f1a083e7826be.json
Remove redundant texture binds Cache currently bound and active textures and move texture binds to WebGLState
src/renderers/webgl/plugins/LensFlarePlugin.js
@@ -43,14 +43,14 @@ THREE.LensFlarePlugin = function ( renderer, flares ) { tempTexture = gl.createTexture(); occlusionTexture = gl.createTexture(); - gl.bindTexture( gl.TEXTURE_2D, tempTexture ); + renderer.state.bindTexture( gl.TEXTURE_2D, tempTexture ); gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null ); gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST ); gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST ); - gl.bindTexture( gl.TEXTURE_2D, occlusionTexture ); + renderer.state.bindTexture( gl.TEXTURE_2D, occlusionTexture ); gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null ); gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE ); @@ -346,8 +346,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) { // save current RGB to temp texture - gl.activeTexture( gl.TEXTURE1 ); - gl.bindTexture( gl.TEXTURE_2D, tempTexture ); + renderer.state.activeTexture( gl.TEXTURE1 ); + renderer.state.bindTexture( gl.TEXTURE_2D, tempTexture ); gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 ); @@ -365,8 +365,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) { // copy result to occlusionMap - gl.activeTexture( gl.TEXTURE0 ); - gl.bindTexture( gl.TEXTURE_2D, occlusionTexture ); + renderer.state.activeTexture( gl.TEXTURE0 ); + renderer.state.bindTexture( gl.TEXTURE_2D, occlusionTexture ); gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 ); @@ -375,8 +375,8 @@ THREE.LensFlarePlugin = function ( renderer, flares ) { gl.uniform1i( uniforms.renderType, 1 ); gl.disable( gl.DEPTH_TEST ); - gl.activeTexture( gl.TEXTURE1 ); - gl.bindTexture( gl.TEXTURE_2D, tempTexture ); + renderer.state.activeTexture( gl.TEXTURE1 ); + renderer.state.bindTexture( gl.TEXTURE_2D, tempTexture ); gl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );
true
Other
mrdoob
three.js
77c7364298361a55deae254e185f1a083e7826be.json
Remove redundant texture binds Cache currently bound and active textures and move texture binds to WebGLState
src/renderers/webgl/plugins/SpritePlugin.js
@@ -114,7 +114,7 @@ THREE.SpritePlugin = function ( renderer, sprites ) { gl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements ); - gl.activeTexture( gl.TEXTURE0 ); + renderer.state.activeTexture( gl.TEXTURE0 ); gl.uniform1i( uniforms.map, 0 ); var oldFogType = 0;
true
Other
mrdoob
three.js
1998ee5fc09bbfffceb15794665e2da31cde0ba6.json
add support for texture folder
utils/exporters/blender/addons/io_three/__init__.py
@@ -42,7 +42,7 @@ bl_info = { 'name': "Three.js Format", 'author': "repsac, mrdoob, yomotsu, mpk, jpweeks", - 'version': (1, 2, 2), + 'version': (1, 2, 3), 'blender': (2, 7, 3), 'location': "File > Export", 'description': "Export Three.js formatted JSON files.", @@ -702,6 +702,7 @@ def execute(self, context): raise Exception("filename not set") settings = save_settings_export(self.properties) + settings['addon_version'] = bl_info['version'] filepath = self.filepath if settings[constants.COMPRESSION] == constants.MSGPACK:
true
Other
mrdoob
three.js
1998ee5fc09bbfffceb15794665e2da31cde0ba6.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/__init__.py
@@ -1,15 +1,18 @@ import os import sys import traceback -from .. import constants, logger, exceptions +from .. import constants, logger, exceptions, dialogs from . import scene, geometry, api, base_classes def _error_handler(func): def inner(filepath, options, *args, **kwargs): level = options.get(constants.LOGGING, constants.DEBUG) + version = options.get('addon_version') logger.init('io_three.export.log', level=level) + if version is not None: + logger.debug("Addon Version %s", version) api.init() try: @@ -55,16 +58,26 @@ def export_scene(filepath, options): @_error_handler def export_geometry(filepath, options, node=None): + msg = "" + exception = None if node is None: node = api.active_object() if node is None: - msg = 'Nothing selected' + msg = "Nothing selected" logger.error(msg) - raise exceptions.SelectionError(msg) + exception = exceptions.SelectionError if node.type != 'MESH': - msg = 'Not a valid mesh object' - raise exceptions.GeometryError(msg) + msg = "%s is not a valid mesh object" % node.name + logger.error(msg) + exception = exceptions.GeometryError + if exception is not None: + if api.batch_mode(): + raise exception(msg) + else: + dialogs.error(msg) + return + mesh = api.object.mesh(node, options) parent = base_classes.BaseScene(filepath, options) geo = geometry.Geometry(mesh, parent)
true
Other
mrdoob
three.js
1998ee5fc09bbfffceb15794665e2da31cde0ba6.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/api/__init__.py
@@ -13,6 +13,16 @@ def active_object(): return bpy.context.scene.objects.active +def batch_mode(): + """ + + :return: Whether or not the session is interactive + :rtype: bool + + """ + return bpy.context.area is None + + def init(): """Initializing the api module. Required first step before initializing the actual export process.
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/__init__.py
@@ -26,7 +26,8 @@ EnumProperty, BoolProperty, FloatProperty, - IntProperty + IntProperty, + StringProperty ) from . import constants @@ -41,7 +42,7 @@ bl_info = { 'name': "Three.js Format", 'author': "repsac, mrdoob, yomotsu, mpk, jpweeks", - 'version': (1, 2, 3), + 'version': (1, 2, 2), 'blender': (2, 7, 3), 'location': "File > Export", 'description': "Export Three.js formatted JSON files.", @@ -295,6 +296,7 @@ def save_settings_export(properties): constants.COMPRESSION: properties.option_compression, constants.INDENT: properties.option_indent, constants.COPY_TEXTURES: properties.option_copy_textures, + constants.TEXTURE_FOLDER: properties.option_texture_folder, constants.SCENE: properties.option_export_scene, #constants.EMBED_GEOMETRY: properties.option_embed_geometry, @@ -420,6 +422,10 @@ def restore_settings_export(properties): constants.COPY_TEXTURES, constants.EXPORT_OPTIONS[constants.COPY_TEXTURES]) + properties.option_texture_folder = settings.get( + constants.TEXTURE_FOLDER, + constants.EXPORT_OPTIONS[constants.TEXTURE_FOLDER]) + properties.option_embed_animation = settings.get( constants.EMBED_ANIMATION, constants.EXPORT_OPTIONS[constants.EMBED_ANIMATION]) @@ -617,6 +623,9 @@ class ExportThree(bpy.types.Operator, ExportHelper): description="Copy textures", default=constants.EXPORT_OPTIONS[constants.COPY_TEXTURES]) + option_texture_folder = StringProperty(name="Texture folder", + description="add this folder to textures path", default="") + option_lights = BoolProperty( name="Lights", description="Export default scene lights", @@ -693,7 +702,6 @@ def execute(self, context): raise Exception("filename not set") settings = save_settings_export(self.properties) - settings['addon_version'] = bl_info['version'] filepath = self.filepath if settings[constants.COMPRESSION] == constants.MSGPACK: @@ -812,6 +820,9 @@ def draw(self, context): row = layout.row() row.prop(self.properties, 'option_copy_textures') + row = layout.row() + row.prop(self.properties, "option_texture_folder") + row = layout.row() row.prop(self.properties, 'option_scale')
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/constants.py
@@ -63,6 +63,7 @@ FACE_MATERIALS = 'faceMaterials' SKINNING = 'skinning' COPY_TEXTURES = 'copyTextures' +TEXTURE_FOLDER = "texture_folder" ENABLE_PRECISION = 'enablePrecision' PRECISION = 'precision' DEFAULT_PRECISION = 6 @@ -91,25 +92,26 @@ EXPORT_OPTIONS = { FACES: True, VERTICES: True, - NORMALS: False, - UVS: False, + NORMALS: True, + UVS: True, COLORS: False, - MATERIALS: False, + MATERIALS: True, FACE_MATERIALS: False, SCALE: 1, FRAME_STEP: 1, FRAME_INDEX_AS_TIME: False, - SCENE: False, + SCENE: True, MIX_COLORS: False, COMPRESSION: None, - MAPS: False, + MAPS: True, ANIMATION: OFF, BONES: False, SKINNING: False, MORPH_TARGETS: False, CAMERAS: False, LIGHTS: False, COPY_TEXTURES: True, + TEXTURE_FOLDER: "", LOGGING: DEBUG, ENABLE_PRECISION: True, PRECISION: DEFAULT_PRECISION,
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/__init__.py
@@ -1,18 +1,15 @@ import os import sys import traceback -from .. import constants, logger, exceptions, dialogs +from .. import constants, logger, exceptions from . import scene, geometry, api, base_classes def _error_handler(func): def inner(filepath, options, *args, **kwargs): level = options.get(constants.LOGGING, constants.DEBUG) - version = options.get('addon_version') logger.init('io_three.export.log', level=level) - if version is not None: - logger.debug("Addon Version %s", version) api.init() try: @@ -58,26 +55,16 @@ def export_scene(filepath, options): @_error_handler def export_geometry(filepath, options, node=None): - msg = "" - exception = None if node is None: node = api.active_object() if node is None: - msg = "Nothing selected" + msg = 'Nothing selected' logger.error(msg) - exception = exceptions.SelectionError + raise exceptions.SelectionError(msg) if node.type != 'MESH': - msg = "%s is not a valid mesh object" % node.name - logger.error(msg) - exception = exceptions.GeometryError + msg = 'Not a valid mesh object' + raise exceptions.GeometryError(msg) - if exception is not None: - if api.batch_mode(): - raise exception(msg) - else: - dialogs.error(msg) - return - mesh = api.object.mesh(node, options) parent = base_classes.BaseScene(filepath, options) geo = geometry.Geometry(mesh, parent)
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/api/__init__.py
@@ -13,16 +13,6 @@ def active_object(): return bpy.context.scene.objects.active -def batch_mode(): - """ - - :return: Whether or not the session is interactive - :rtype: bool - - """ - return bpy.context.area is None - - def init(): """Initializing the api module. Required first step before initializing the actual export process.
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/api/material.py
@@ -380,7 +380,7 @@ def _valid_textures(material): for texture in material.texture_slots: if not texture: continue - if texture.texture.type != IMAGE: + if texture.texture.type != IMAGE or not texture.use: continue logger.debug("Valid texture found %s", texture) yield texture
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/api/texture.py
@@ -170,6 +170,9 @@ def textures(): """ logger.debug("texture.textures()") - for texture in data.textures: - if texture.type == IMAGE: - yield texture.name + for mat in data.materials: + if mat.users == 0: + continue + for slot in mat.texture_slots: + if slot and slot.use and slot.texture.type == IMAGE: + yield slot.texture.name
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/geometry.py
@@ -135,15 +135,15 @@ def copy(self, scene=True): return data - def copy_textures(self): + def copy_textures(self, texture_folder=""): """Copy the textures to the destination directory.""" logger.debug("Geometry().copy_textures()") if self.options.get(constants.COPY_TEXTURES): texture_registration = self.register_textures() if texture_registration: logger.info("%s has registered textures", self.node) io.copy_registered_textures( - os.path.dirname(self.scene.filepath), + os.path.join(os.path.dirname(self.scene.filepath), texture_folder), texture_registration) def parse(self):
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/image.py
@@ -11,7 +11,8 @@ def __init__(self, node, parent): logger.debug("Image().__init__(%s)", node) base_classes.BaseNode.__init__(self, node, parent, constants.IMAGE) - self[constants.URL] = api.image.file_name(self.node) + texture_folder = self.scene.options.get(constants.TEXTURE_FOLDER, "") + self[constants.URL] = os.path.join(texture_folder, api.image.file_name(self.node)) @property def destination(self):
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/io.py
@@ -14,6 +14,7 @@ def copy_registered_textures(dest, registration): """ logger.debug("io.copy_registered_textures(%s, %s)", dest, registration) + os.makedirs(dest, exist_ok=True) for value in registration.values(): copy(value['file_path'], dest)
true
Other
mrdoob
three.js
932ee2d443e2661103629d82dac4ab936796275d.json
add support for texture folder
utils/exporters/blender/addons/io_three/exporter/scene.py
@@ -159,9 +159,10 @@ def write(self): io.dump(self.filepath, data, options=self.options) if self.options.get(constants.COPY_TEXTURES): + texture_folder = self.options.get(constants.TEXTURE_FOLDER) for geo in self[constants.GEOMETRIES]: logger.info("Copying textures from %s", geo.node) - geo.copy_textures() + geo.copy_textures(texture_folder) def _parse_geometries(self): """Locate all geometry nodes and parse them"""
true
Other
mrdoob
three.js
43c5354f94492ad7a8a4379b449a63215267822d.json
add support for normal/bump scale
src/loaders/ObjectLoader.js
@@ -5,6 +5,7 @@ THREE.ObjectLoader = function ( manager ) { this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; + this.texturePath = ''; }; @@ -14,7 +15,7 @@ THREE.ObjectLoader.prototype = { load: function ( url, onLoad, onProgress, onError ) { - if ( this.texturePath === undefined ) { + if ( this.texturePath === '' ) { this.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 ); @@ -245,6 +246,9 @@ THREE.ObjectLoader.prototype = { if ( data.bumpMap !== undefined ) { material.bumpMap = getTexture( data.bumpMap ); + if ( data.bumpScale ) { + material.bumpScale = new THREE.Vector2( data.bumpScale, data.bumpScale ); + } } @@ -263,6 +267,9 @@ THREE.ObjectLoader.prototype = { if ( data.normalMap !== undefined ) { material.normalMap = getTexture( data.normalMap ); + if ( data.normalScale ) { + material.normalScale = new THREE.Vector2( data.normalScale, data.normalScale ); + } }
false
Other
mrdoob
three.js
e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json
Fix 'Math.sign' polyfill to match ES6 specs
src/Three.js
@@ -16,9 +16,11 @@ if ( typeof module === 'object' ) { if ( Math.sign === undefined ) { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign + Math.sign = function ( x ) { - return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0; + return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : +x; };
true
Other
mrdoob
three.js
e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json
Fix 'Math.sign' polyfill to match ES6 specs
test/unit/math/Math.js
@@ -0,0 +1,35 @@ +/** + * @author humbletim / https://github.com/humbletim + */ + +module( "Math" ); + +//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign +//http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.sign +/* +20.2.2.29 Math.sign(x) + +Returns the sign of the x, indicating whether x is positive, negative or zero. + +If x is NaN, the result is NaN. +If x is -0, the result is -0. +If x is +0, the result is +0. +If x is negative and not -0, the result is -1. +If x is positive and not +0, the result is +1. +*/ + +test( "Math.sign/polyfill", function() { + + ok( isNaN( Math.sign(NaN) ) , "If x is NaN<NaN>, the result is NaN."); + ok( isNaN( Math.sign(new THREE.Vector3()) ) , "If x is NaN<object>, the result is NaN."); + ok( isNaN( Math.sign() ) , "If x is NaN<undefined>, the result is NaN."); + ok( isNaN( Math.sign('--3') ) , "If x is NaN<'--3'>, the result is NaN."); + ok( Math.sign(-0) === -0 , "If x is -0, the result is -0."); + ok( Math.sign(+0) === +0 , "If x is +0, the result is +0."); + ok( Math.sign(-Infinity) === -1 , "If x is negative<-Infinity> and not -0, the result is -1."); + ok( Math.sign('-3') === -1 , "If x is negative<'-3'> and not -0, the result is -1."); + ok( Math.sign('-1e-10') === -1 , "If x is negative<'-1e-10'> and not -0, the result is -1."); + ok( Math.sign(+Infinity) === +1 , "If x is positive<+Infinity> and not +0, the result is +1."); + ok( Math.sign('+3') === +1 , "If x is positive<'+3'> and not +0, the result is +1."); + +});
true
Other
mrdoob
three.js
e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json
Fix 'Math.sign' polyfill to match ES6 specs
test/unit/unittests_sources.html
@@ -45,6 +45,7 @@ <script src="math/Euler.js"></script> <script src="math/Line3.js"></script> <script src="math/Quaternion.js"></script> + <script src="math/Math.js"></script> <script src="math/Matrix3.js"></script> <script src="math/Matrix4.js"></script> <script src="math/Frustum.js"></script>
true
Other
mrdoob
three.js
e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json
Fix 'Math.sign' polyfill to match ES6 specs
test/unit/unittests_three-math.html
@@ -28,6 +28,7 @@ <script src="math/Euler.js"></script> <script src="math/Line3.js"></script> <script src="math/Quaternion.js"></script> + <script src="math/Math.js"></script> <script src="math/Matrix3.js"></script> <script src="math/Matrix4.js"></script> <script src="math/Frustum.js"></script>
true
Other
mrdoob
three.js
e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json
Fix 'Math.sign' polyfill to match ES6 specs
test/unit/unittests_three.html
@@ -28,6 +28,7 @@ <script src="math/Euler.js"></script> <script src="math/Line3.js"></script> <script src="math/Quaternion.js"></script> + <script src="math/Math.js"></script> <script src="math/Matrix3.js"></script> <script src="math/Matrix4.js"></script> <script src="math/Frustum.js"></script>
true
Other
mrdoob
three.js
e5cc53358c619c8aa7c9c26de137236d00b1fbf0.json
Fix 'Math.sign' polyfill to match ES6 specs
test/unit/unittests_three.min.html
@@ -28,6 +28,7 @@ <script src="math/Euler.js"></script> <script src="math/Line3.js"></script> <script src="math/Quaternion.js"></script> + <script src="math/Math.js"></script> <script src="math/Matrix3.js"></script> <script src="math/Matrix4.js"></script> <script src="math/Frustum.js"></script>
true
Other
mrdoob
three.js
8101efea28e683237efd01daedd6b4c9a2bcc611.json
Fix EffectComposer reference to renderer. should be `this.renderer`
examples/js/postprocessing/EffectComposer.js
@@ -110,7 +110,7 @@ THREE.EffectComposer.prototype = { renderTarget = this.renderTarget1.clone(); - var pixelRatio = renderer.getPixelRatio(); + var pixelRatio = this.renderer.getPixelRatio(); renderTarget.width = Math.floor( this.renderer.context.canvas.width / pixelRatio ); renderTarget.height = Math.floor( this.renderer.context.canvas.height / pixelRatio );
false
Other
mrdoob
three.js
8019d61f78c52719ef7de49c318067b18edcf6aa.json
fix bug in merge - need to use outgoingColor here.
src/renderers/shaders/ShaderChunk/linear_to_gamma_fragment.glsl
@@ -1 +1 @@ - gl_FragColor.xyz = linearToOutput( gl_FragColor.xyz ); \ No newline at end of file + outgoingLight.xyz = linearToOutput( outgoingLight.xyz ); \ No newline at end of file
false
Other
mrdoob
three.js
cdd6d71522cc4e353426f1a15e6ad7021414d279.json
reduce greeness of light in morph example.
examples/webgl_animation_skinning_morph.html
@@ -127,7 +127,7 @@ // - var light = new THREE.DirectionalLight( 0x497f13, 1 ); + var light = new THREE.DirectionalLight( 0x493f13, 1 ); light.position.set( 0, -1, 0 ); scene.add( light );
false
Other
mrdoob
three.js
28b633b93a8459de0d7a792ee4a162bc7aac0398.json
Fix typo in comment: mirorr -> mirror
examples/webgl_mirror.html
@@ -86,7 +86,7 @@ var planeGeo = new THREE.PlaneBufferGeometry( 100.1, 100.1 ); - // MIRORR planes + // MIRROR planes groundMirror = new THREE.Mirror( renderer, camera, { clipBias: 0.003, textureWidth: WIDTH, textureHeight: HEIGHT, color: 0x777777 } ); var mirrorMesh = new THREE.Mesh( planeGeo, groundMirror.material );
false
Other
mrdoob
three.js
5f6b04a5848e5cb0f2392a7b407bde6dd26137bc.json
Add position tracking to VRControls
examples/js/controls/VRControls.js
@@ -44,11 +44,17 @@ THREE.VRControls = function ( object, callback ) { if ( vrInput === undefined ) return; - var orientation = vrInput.getState().orientation; + var state = vrInput.getState(); - if ( orientation !== null ) { + if ( state.orientation !== null ) { - object.quaternion.set( orientation.x, orientation.y, orientation.z, orientation.w ); + object.quaternion.copy( state.orientation ); + + } + + if ( state.position !== null ) { + + object.position.copy( state.position ); }
false
Other
mrdoob
three.js
de92b6e71d7de887da53c05fc1c902201cc4bee9.json
fix wrong Integer type
docs/api/loaders/OBJMTLLoader.html
@@ -33,7 +33,7 @@ <h3>[method:null load]( [page:String objUrl], [page:String mtlUrl], [page:Functi [page:String objUrl] — required. URL to the <em>.obj</em> resource<br /> [page:String mtlUrl] — required. URL to the <em>.mtl</em> resource<br /> [page:Function onLoad] — Will be called when both resources load complete. The argument will be the loaded [page:Object3D].<br /> - [page:Function onProgress] — Will be called while both load progress. The argument will be the XmlHttpRequest instance, that contain .[page:int total] and .[page:int loaded] bytes.<br /> + [page:Function onProgress] — Will be called while both load progress. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br /> [page:Function onError] — Will be called when load errors.<br /> </div> <div>
true
Other
mrdoob
three.js
de92b6e71d7de887da53c05fc1c902201cc4bee9.json
fix wrong Integer type
docs/api/loaders/ObjectLoader.html
@@ -32,7 +32,7 @@ <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Functio <div> [page:String url] — required<br /> [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br /> - [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:int total] and .[page:int loaded] bytes.<br /> + [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br /> [page:Function onError] — Will be called when load errors.<br /> </div> <div>
true
Other
mrdoob
three.js
de92b6e71d7de887da53c05fc1c902201cc4bee9.json
fix wrong Integer type
docs/api/loaders/SVGLoader.html
@@ -32,7 +32,7 @@ <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Functio <div> [page:String url] — required<br /> [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:SVGDocument].<br /> - [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:int total] and .[page:int loaded] bytes.<br /> + [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br /> [page:Function onError] — Will be called when load errors.<br /> </div> <div>
true
Other
mrdoob
three.js
de92b6e71d7de887da53c05fc1c902201cc4bee9.json
fix wrong Integer type
docs/api/loaders/SceneLoader.html
@@ -32,7 +32,7 @@ <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Functio <div> [page:String url] — required<br /> [page:Function onLoad] — Will be called when load completes. The argument will be an [page:Object] containing the loaded components.<br /> - [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:int total] and .[page:int loaded] bytes.<br /> + [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br /> [page:Function onError] — Will be called when load errors.<br /> </div> <div>
true
Other
mrdoob
three.js
040d1621777d1bc3b8a138c0f017e7a9c67403a8.json
add missing LoadingManager
examples/js/loaders/SVGLoader.js
@@ -15,9 +15,11 @@ THREE.SVGLoader.prototype = { load: function ( url, onLoad, onProgress, onError ) { + var scope = this; + var parser = new DOMParser(); - var loader = new THREE.XHRLoader(); + var loader = new THREE.XHRLoader( scope.manager ); loader.setCrossOrigin( this.crossOrigin ); loader.load( url, function ( svgString ) {
false
Other
mrdoob
three.js
bbf4c70823288f2253de1a66ac503eb2affac5c6.json
Pass texture in onUpdate So generic onupdate function can be used, pass in texture as parameter
src/renderers/WebGLRenderer.js
@@ -5588,7 +5588,7 @@ THREE.WebGLRenderer = function ( parameters ) { texture.needsUpdate = false; - if ( texture.onUpdate ) texture.onUpdate(); + if ( texture.onUpdate ) texture.onUpdate( texture ); }; @@ -5735,7 +5735,7 @@ THREE.WebGLRenderer = function ( parameters ) { texture.needsUpdate = false; - if ( texture.onUpdate ) texture.onUpdate(); + if ( texture.onUpdate ) texture.onUpdate( texture ); } else {
false
Other
mrdoob
three.js
54f62cb593e99fac6e52b8fba57329ba3c1098cd.json
load lightMapScale in ObjectLoader.
src/loaders/ObjectLoader.js
@@ -278,6 +278,10 @@ THREE.ObjectLoader.prototype = { material.lightMap = getTexture( data.lightMap ); + if ( data.lightMapScale !== undefined ) { + material.lightMapScale = data.lightMapScale; + } + } if ( data.aoMap !== undefined ) {
false
Other
mrdoob
three.js
c547d98f085c1e202300e2b81494abe424852e45.json
Fix Chrome from 'Multiply' to 'MultiplyOperation'
examples/webgl_materials_cars.html
@@ -250,7 +250,7 @@ "Carmine": new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, envMap: textureCube, combine: THREE.MultiplyOperation } ), "Gold": new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, envMap: textureCube, combine: THREE.MultiplyOperation } ), "Bronze": new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ), - "Chrome": new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.Multiply } ), + "Chrome": new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.MultiplyOperation } ), "Orange metal": new THREE.MeshLambertMaterial( { color: 0xff6600, ambient: 0xff2200, envMap: textureCube, combine: THREE.MultiplyOperation } ), "Blue metal": new THREE.MeshLambertMaterial( { color: 0x001133, ambient: 0x002266, envMap: textureCube, combine: THREE.MultiplyOperation } ),
false
Other
mrdoob
three.js
9b781b1542ac5376d4f58f92c38b5f191bc0d6d7.json
Add comments to describe the modification
examples/js/loaders/STLLoader.js
@@ -68,8 +68,9 @@ THREE.STLLoader.prototype = { } + // some binary files will have different size from expected, + // checking characters higher than ASCII to confirm is binary var fileLength = reader.byteLength; - for ( var index = 0; index < fileLength; index ++ ) { if ( reader.getUint8(index, false) > 127 ) {
false
Other
mrdoob
three.js
bb64625533a4d74fd0e4fc8bb8ed36abf2a8a2fe.json
Improve ability to detect the format of a STL file For some reason, few binary STL files will have larger size than the value calculated based on metadata, causing them to be recognized as ASCII ones. To detect those files, a byte-by-byte check loop is added, it tries to find a non-ASCII character byte, if any is found, this file will be recognized as binary format. The additional checking process slightly affected the loading time of ASCII files, for example a 78MB ASCII file will need 3 more seconds to go through the loop using a computer manufactured in 2012. However most mesh in this size will be encoded in binary format, so large ASCII file is uncommon.
examples/js/loaders/STLLoader.js
@@ -61,7 +61,26 @@ THREE.STLLoader.prototype = { face_size = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8); n_faces = reader.getUint32(80,true); expect = 80 + (32 / 8) + (n_faces * face_size); - return expect === reader.byteLength; + + if ( expect === reader.byteLength ) { + + return true; + + } + + var fileLength = reader.byteLength; + + for ( var index = 0; index < fileLength; index ++ ) { + + if ( reader.getUint8(index, false) > 127 ) { + + return true; + + } + + } + + return false; };
false
Other
mrdoob
three.js
0479681978b3f0e599e43285525b25100ca3783b.json
fix bug in ENVMAP_TYPE_SPHERE mapping.
src/renderers/shaders/ShaderChunk/envmap_fragment.glsl
@@ -39,7 +39,7 @@ vec4 envColor = texture2D( envMap, sampleUV ); #elif defined( ENVMAP_TYPE_SPHERE ) - vec3 reflectView = flipNormal * ( transformDirection( reflectVec, viewMatrix ) + vec3(0.0,0.0,1.0) ); + vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0)); vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 ); #endif
false
Other
mrdoob
three.js
c222310930338f978d958857db0a99bd437d18c3.json
Optimize TessellateModifier.js slightly `.distanceTo()` -> `distanceToSquared()`
examples/js/modifiers/TessellateModifier.js
@@ -17,7 +17,7 @@ THREE.TessellateModifier.prototype.modify = function ( geometry ) { var faces = []; var faceVertexUvs = []; - var maxEdgeLength = this.maxEdgeLength; + var maxEdgeLengthSquared = this.maxEdgeLength * this.maxEdgeLength; for ( var i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) { @@ -39,11 +39,11 @@ THREE.TessellateModifier.prototype.modify = function ( geometry ) { var vb = geometry.vertices[ b ]; var vc = geometry.vertices[ c ]; - var dab = va.distanceTo( vb ); - var dbc = vb.distanceTo( vc ); - var dac = va.distanceTo( vc ); + var dab = va.distanceToSquared( vb ); + var dbc = vb.distanceToSquared( vc ); + var dac = va.distanceToSquared( vc ); - if ( dab > maxEdgeLength || dbc > maxEdgeLength || dac > maxEdgeLength ) { + if ( dab > maxEdgeLengthSquared || dbc > maxEdgeLengthSquared || dac > maxEdgeLengthSquared ) { var m = geometry.vertices.length;
false
Other
mrdoob
three.js
4fd2c9627ff17a47573dda2059d830cb5933118f.json
remove stray gamma correction from ToneMapShader.
examples/js/shaders/ToneMapShader.js
@@ -67,8 +67,6 @@ THREE.ToneMapShader = { "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );", - //Gamma 2.0 - "gl_FragColor.xyz = sqrt( gl_FragColor.xyz );", "}"
false
Other
mrdoob
three.js
0bf4bb001020fbb2d6b447d6b1abe7bbe830454e.json
Add function for setting volume
src/extras/audio/Audio.js
@@ -64,6 +64,12 @@ THREE.Audio.prototype.setRolloffFactor = function ( value ) { }; +THREE.Audio.prototype.setVolume = function ( value ) { + + this.gain.gain.value = value; + +}; + THREE.Audio.prototype.updateMatrixWorld = ( function () { var position = new THREE.Vector3();
false
Other
mrdoob
three.js
e5ae7d153be11a97618259bbb787290bea94e590.json
Update ObjectLoader.js to load different maps Simple extension to the PR submitted by @denzp https://github.com/mrdoob/three.js/pull/5502 to allow for other map types. Tested here with map, bumpMap, and alphaMap: http://datable.net/WebGL/Test299/
src/loaders/ObjectLoader.js
@@ -229,11 +229,83 @@ THREE.ObjectLoader.prototype = { console.warn( 'THREE.ObjectLoader: Undefined texture', data.map ); - } + } material.map = textures[ data.map ]; } + + if ( data.bumpMap ) { + + if ( !textures[data.bumpMap] ) { + + console.warn( 'THREE.ObjectLoader: Undefined texture', data.bumpMap ); + + } + + material.bumpMap = textures[data.bumpMap]; + + } + + if ( data.alphaMap ) { + + if ( !textures[data.alphaMap] ) { + + console.warn( 'THREE.ObjectLoader: Undefined texture', data.alphaMap ); + + } + + material.alphaMap = textures[data.alphaMap]; + + } + + if ( data.envMap ) { + + if ( !textures[data.envMap] ) { + + console.warn( 'THREE.ObjectLoader: Undefined texture', data.envMap ); + + } + + material.envMap = textures[data.envMap]; + + } + + if ( data.normalMap ) { + + if ( !textures[data.normalMap] ) { + + console.warn( 'THREE.ObjectLoader: Undefined texture', data.normalMap ); + + } + + material.normalMap = textures[data.normalMap]; + + } + + if ( data.lightMap ) { + + if ( !textures[data.lightMap] ) { + + console.warn( 'THREE.ObjectLoader: Undefined texture', data.lightMap ); + + } + + material.lightMap = textures[data.lightMap]; + + } + + if ( data.specularMap ) { + + if ( !textures[data.specularMap] ) { + + console.warn( 'THREE.ObjectLoader: Undefined texture', data.specularMap ); + + } + + material.specularMap = textures[data.specularMap]; + + } materials[ data.uuid ] = material;
false
Other
mrdoob
three.js
39289c9dece88d87638344da5616c8df0ef4a05c.json
Remove unused variable
src/extras/geometries/ParametricGeometry.js
@@ -23,7 +23,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks ) { var faces = this.faces; var uvs = this.faceVertexUvs[ 0 ]; - var i, il, j, p; + var i, j, p; var u, v; var stackCount = stacks + 1;
false
Other
mrdoob
three.js
bd9c4662e07e554ccb2c7595bf6f0f4c147011b7.json
Update EdgesHelper.js to support BufferGeometry
src/extras/helpers/EdgesHelper.js
@@ -12,7 +12,17 @@ THREE.EdgesHelper = function ( object, hex ) { var keys = [ 'a', 'b', 'c' ]; var geometry = new THREE.BufferGeometry(); - var geometry2 = object.geometry.clone(); + var geometry2; + if ( object.geometry instanceof THREE.BufferGeometry ) { + + geometry2 = new THREE.Geometry(); + geometry2.fromBufferGeometry( object.geometry ); + + } else { + + geometry2 = object.geometry.clone(); + + } geometry2.mergeVertices(); geometry2.computeFaceNormals();
false
Other
mrdoob
three.js
4c9a7f6fd114ad0095cdafe0305c3f3dff8bb972.json
Add a button to show/hide the grid.
editor/js/Editor.js
@@ -36,7 +36,9 @@ var Editor = function () { fogTypeChanged: new SIGNALS.Signal(), fogColorChanged: new SIGNALS.Signal(), fogParametersChanged: new SIGNALS.Signal(), - windowResize: new SIGNALS.Signal() + windowResize: new SIGNALS.Signal(), + + showGridChanged: new SIGNALS.Signal() };
true
Other
mrdoob
three.js
4c9a7f6fd114ad0095cdafe0305c3f3dff8bb972.json
Add a button to show/hide the grid.
editor/js/Toolbar.js
@@ -45,10 +45,15 @@ var Toolbar = function ( editor ) { buttons.add( local ); buttons.add( new UI.Text( 'local' ) ); + var showGrid = new UI.Checkbox().onChange( update ).setValue( true ); + buttons.add( showGrid ); + buttons.add( new UI.Text( 'show' ) ); + function update() { signals.snapChanged.dispatch( snap.getValue() === true ? grid.getValue() : null ); signals.spaceChanged.dispatch( local.getValue() === true ? "local" : "world" ); + signals.showGridChanged.dispatch( showGrid.getValue() ); }
true
Other
mrdoob
three.js
4c9a7f6fd114ad0095cdafe0305c3f3dff8bb972.json
Add a button to show/hide the grid.
editor/js/Viewport.js
@@ -430,6 +430,13 @@ var Viewport = function ( editor ) { } ); + signals.showGridChanged.add( function ( showGrid ) { + + grid.visible = showGrid; + render(); + + } ); + var animations = []; signals.playAnimation.add( function ( animation ) {
true
Other
mrdoob
three.js
b2dd2418e298020903fd30c78227aa5ee21abeea.json
Fix coding style #2
src/math/Quaternion.js
@@ -399,9 +399,9 @@ THREE.Quaternion.prototype = { slerp: function ( qb, t ) { - if (t === 0) return this; + if ( t === 0 ) return this; - if (t === 1) return this.copy( qb ); + if ( t === 1 ) return this.copy( qb ); var x = this._x, y = this._y, z = this._z, w = this._w;
false
Other
mrdoob
three.js
99b7e5311a04583e67c0e9daab5a9595a5157cdc.json
Fix coding style
src/math/Quaternion.js
@@ -399,17 +399,9 @@ THREE.Quaternion.prototype = { slerp: function ( qb, t ) { - if (t === 0) { + if (t === 0) return this; - return this; - - } - - else if (t === 1) { - - return this.copy( qb ); - - } + if (t === 1) return this.copy( qb ); var x = this._x, y = this._y, z = this._z, w = this._w;
true
Other
mrdoob
three.js
99b7e5311a04583e67c0e9daab5a9595a5157cdc.json
Fix coding style
test/unit/math/Quaternion.js
@@ -214,6 +214,6 @@ test( "slerp", function() { var a = new THREE.Quaternion( 0.675341, 0.408783, 0.328567, 0.518512 ); var b = new THREE.Quaternion( 0.660279, 0.436474, 0.35119, 0.500187 ); - ok( a.slerp(b, 0).equals(a), "Passed!" ); - ok( a.slerp(b, 1).equals(b), "Passed!" ); + ok( a.slerp( b, 0 ).equals( a ), "Passed!" ); + ok( a.slerp( b, 1 ).equals( b ), "Passed!" ); });
true
Other
mrdoob
three.js
3c1c8318005efeea385ef641424c2e5cd6f4f6b7.json
add uploadTexture to WebGLRenderer There should be no change in setTexture behavior.
src/renderers/WebGLRenderer.js
@@ -5610,108 +5610,114 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setTexture = function ( texture, slot ) { + this.uploadTexture = function ( texture ) { - if ( texture.needsUpdate ) { + if ( ! texture.__webglInit ) { - if ( ! texture.__webglInit ) { + texture.__webglInit = true; - texture.__webglInit = true; + texture.addEventListener( 'dispose', onTextureDispose ); - texture.addEventListener( 'dispose', onTextureDispose ); + texture.__webglTexture = _gl.createTexture(); - texture.__webglTexture = _gl.createTexture(); + _this.info.memory.textures ++; - _this.info.memory.textures ++; + } - } + _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); + _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); + _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); + _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); - _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); - _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); - _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment ); + var image = texture.image, + isImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ), + glFormat = paramThreeToGL( texture.format ), + glType = paramThreeToGL( texture.type ); - var image = texture.image, - isImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ), - glFormat = paramThreeToGL( texture.format ), - glType = paramThreeToGL( texture.type ); + setTextureParameters( _gl.TEXTURE_2D, texture, isImagePowerOfTwo ); - setTextureParameters( _gl.TEXTURE_2D, texture, isImagePowerOfTwo ); + var mipmap, mipmaps = texture.mipmaps; - var mipmap, mipmaps = texture.mipmaps; + if ( texture instanceof THREE.DataTexture ) { - if ( texture instanceof THREE.DataTexture ) { + // use manually created mipmaps if available + // if there are no manual mipmaps + // set 0 level mipmap and then use GL to generate other mipmap levels - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels + if ( mipmaps.length > 0 && isImagePowerOfTwo ) { - if ( mipmaps.length > 0 && isImagePowerOfTwo ) { + for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { + mipmap = mipmaps[ i ]; + _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - mipmap = mipmaps[ i ]; - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); + } - } + texture.generateMipmaps = false; + + } else { - texture.generateMipmaps = false; + _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data ); - } else { + } + + } else if ( texture instanceof THREE.CompressedTexture ) { - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data ); + for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { + mipmap = mipmaps[ i ]; + if ( texture.format !== THREE.RGBAFormat ) { + _gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); + } else { + _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); } - } else if ( texture instanceof THREE.CompressedTexture ) { + } + + } else { // regular Texture (image, video, canvas) + + // use manually created mipmaps if available + // if there are no manual mipmaps + // set 0 level mipmap and then use GL to generate other mipmap levels + + if ( mipmaps.length > 0 && isImagePowerOfTwo ) { for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { mipmap = mipmaps[ i ]; - if ( texture.format !== THREE.RGBAFormat ) { - _gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data ); - } else { - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data ); - } + _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap ); } - } else { // regular Texture (image, video, canvas) + texture.generateMipmaps = false; - // use manually created mipmaps if available - // if there are no manual mipmaps - // set 0 level mipmap and then use GL to generate other mipmap levels - - if ( mipmaps.length > 0 && isImagePowerOfTwo ) { + } else { - for ( var i = 0, il = mipmaps.length; i < il; i ++ ) { + _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, texture.image ); - mipmap = mipmaps[ i ]; - _gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap ); + } - } + } - texture.generateMipmaps = false; + if ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); - } else { + texture.needsUpdate = false; - _gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, texture.image ); + if ( texture.onUpdate ) texture.onUpdate(); - } + }; - } + this.setTexture = function ( texture, slot ) { - if ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D ); + _gl.activeTexture( _gl.TEXTURE0 + slot ); - texture.needsUpdate = false; + if ( texture.needsUpdate ) { - if ( texture.onUpdate ) texture.onUpdate(); + _this.uploadTexture( texture ); } else { - _gl.activeTexture( _gl.TEXTURE0 + slot ); _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); }
false
Other
mrdoob
three.js
1965a19f3d62f01d54767f94b64612d265991833.json
Fix Quaternion.slerp for special case t=0 and t=1 returned value was not exactly source or target quaternion thus was preventing testing using equal
src/math/Quaternion.js
@@ -399,6 +399,18 @@ THREE.Quaternion.prototype = { slerp: function ( qb, t ) { + if (t === 0) { + + return this; + + } + + else if (t === 1) { + + return this.copy( qb ); + + } + var x = this._x, y = this._y, z = this._z, w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
true
Other
mrdoob
three.js
1965a19f3d62f01d54767f94b64612d265991833.json
Fix Quaternion.slerp for special case t=0 and t=1 returned value was not exactly source or target quaternion thus was preventing testing using equal
test/unit/math/Quaternion.js
@@ -209,3 +209,11 @@ test( "equals", function() { ok( a.equals( b ), "Passed!" ); ok( b.equals( a ), "Passed!" ); }); + +test( "slerp", function() { + var a = new THREE.Quaternion( 0.675341, 0.408783, 0.328567, 0.518512 ); + var b = new THREE.Quaternion( 0.660279, 0.436474, 0.35119, 0.500187 ); + + ok( a.slerp(b, 0).equals(a), "Passed!" ); + ok( a.slerp(b, 1).equals(b), "Passed!" ); +});
true
Other
mrdoob
three.js
3dd811eebcfcf244bd916f8b5684adbc144c2f3a.json
reverse animation with negative timeScale
src/extras/animation/Animation.js
@@ -160,15 +160,23 @@ THREE.Animation.prototype.update = (function(){ var duration = this.data.length; - if ( this.loop === true && this.currentTime > duration ) { + if ( this.currentTime > duration || this.currentTime < 0 ) { - this.currentTime %= duration; - this.reset(); + if ( this.loop ) { - } else if ( this.loop === false && this.currentTime > duration ) { + this.currentTime %= duration; - this.stop(); - return; + if ( this.currentTime < 0 ) + this.currentTime += duration; + + this.reset(); + + } else { + + this.stop(); + return; + + } } @@ -187,7 +195,8 @@ THREE.Animation.prototype.update = (function(){ var prevKey = animationCache.prevKey[ type ]; var nextKey = animationCache.nextKey[ type ]; - if ( nextKey.time <= this.currentTime ) { + if ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) || + ( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) { prevKey = this.data.hierarchy[ h ].keys[ 0 ]; nextKey = this.getNextKeyWith( type, h, 1 );
false
Other
mrdoob
three.js
93517e66c7aef4efdce05d5cd2d222831eb33bff.json
fix bug related to semi-transparent maps.
src/renderers/shaders/ShaderChunk/map_fragment.glsl
@@ -8,6 +8,6 @@ #endif - diffuseColor.rgb *= texelColor.rgb; + diffuseColor *= texelColor; #endif \ No newline at end of file
false
Other
mrdoob
three.js
f31bdfe4ef91082f00d08cf0be16987f63523cba.json
use correct indenting
editor/index.html
@@ -81,7 +81,7 @@ <script src="js/Toolbar.js"></script> <script src="js/Viewport.js"></script> <script src="js/Viewport.Info.js"></script> - <script src="js/Fullscreen.js"></script> + <script src="js/Fullscreen.js"></script> <script>
true
Other
mrdoob
three.js
f31bdfe4ef91082f00d08cf0be16987f63523cba.json
use correct indenting
editor/js/Fullscreen.js
@@ -1,11 +1,13 @@ -function launchIntoFullscreen(element) { - if(element.requestFullscreen) { - element.requestFullscreen(); - } else if(element.mozRequestFullScreen) { - element.mozRequestFullScreen(); - } else if(element.webkitRequestFullscreen) { - element.webkitRequestFullscreen(); - } else if(element.msRequestFullscreen) { - element.msRequestFullscreen(); - } +var launchIntoFullscreen = function ( element ) { + + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } + }
true
Other
mrdoob
three.js
f31bdfe4ef91082f00d08cf0be16987f63523cba.json
use correct indenting
editor/js/Menubar.View.js
@@ -42,20 +42,20 @@ Menubar.View = function ( editor ) { } ); options.add( option ); - // + // - options.add( new UI.HorizontalRule() ); + options.add( new UI.HorizontalRule() ); - // fullscreen - var option = new UI.Panel(); - option.setClass( 'option' ); - option.setTextContent( 'Fullscreen' ); - option.onClick( function () { + // fullscreen + var option = new UI.Panel(); + option.setClass( 'option' ); + option.setTextContent( 'Fullscreen' ); + option.onClick( function () { - launchIntoFullscreen(document.body); + launchIntoFullscreen(document.body); - } ); - options.add( option ); + } ); + options.add( option ); return container;
true
Other
mrdoob
three.js
0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json
add fullscreen mode (from view menu)
editor/css/dark.css
@@ -52,6 +52,8 @@ input.Number { background: #111; padding: 0px; margin: 0px; + right: 0px; + top: 0px; } #menubar .menu {
true
Other
mrdoob
three.js
0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json
add fullscreen mode (from view menu)
editor/css/light.css
@@ -53,6 +53,8 @@ input.Number { background: #eee; padding: 0px; margin: 0px; + right: 0px; + top: 0px; } #menubar .menu {
true
Other
mrdoob
three.js
0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json
add fullscreen mode (from view menu)
editor/index.html
@@ -81,6 +81,7 @@ <script src="js/Toolbar.js"></script> <script src="js/Viewport.js"></script> <script src="js/Viewport.Info.js"></script> + <script src="js/Fullscreen.js"></script> <script>
true
Other
mrdoob
three.js
0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json
add fullscreen mode (from view menu)
editor/js/Fullscreen.js
@@ -0,0 +1,11 @@ +function launchIntoFullscreen(element) { + if(element.requestFullscreen) { + element.requestFullscreen(); + } else if(element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if(element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if(element.msRequestFullscreen) { + element.msRequestFullscreen(); + } +}
true
Other
mrdoob
three.js
0eabadc4e0d84f3ef706b7bb65f1af14a838ede1.json
add fullscreen mode (from view menu)
editor/js/Menubar.View.js
@@ -42,6 +42,21 @@ Menubar.View = function ( editor ) { } ); options.add( option ); + // + + options.add( new UI.HorizontalRule() ); + + // fullscreen + var option = new UI.Panel(); + option.setClass( 'option' ); + option.setTextContent( 'Fullscreen' ); + option.onClick( function () { + + launchIntoFullscreen(document.body); + + } ); + options.add( option ); + return container; };
true
Other
mrdoob
three.js
7f656a89ac59b78543cc754cb9a1104e8b8a6426.json
make use of optionalData on THREE.error.
src/renderers/webgl/WebGLProgram.js
@@ -334,17 +334,20 @@ THREE.WebGLProgram = ( function () { _gl.linkProgram( program ); + var programLogInfo = _gl.getProgramInfoLog( program ); + if ( _gl.getProgramParameter( program, _gl.LINK_STATUS ) === false ) { - THREE.error( 'THREE.WebGLProgram: Could not initialise shader.' ); - THREE.error( 'gl.VALIDATE_STATUS', _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ) ); - THREE.error( 'gl.getError()', _gl.getError() ); + THREE.error( 'THREE.WebGLProgram: shader error: ' + _gl.getError(), { + 'gl.VALIDATE_STATUS': _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ), + 'gl.getPRogramInfoLog': programLogInfo + }); } + + if ( programLogInfo !== '' ) { - if ( _gl.getProgramInfoLog( program ) !== '' ) { - - THREE.warning( 'THREE.WebGLProgram: gl.getProgramInfoLog()', _gl.getProgramInfoLog( program ) ); + THREE.warning( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLogInfo ); // THREE.warning( _gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glVertexShader ) ); // THREE.warning( _gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glFragmentShader ) );
false
Other
mrdoob
three.js
7af872306ab5e24d63563bfce046efa3207f8c65.json
add Euler.setFromVector helper.
src/math/Euler.js
@@ -242,6 +242,12 @@ THREE.Euler.prototype = { }(), + setFromVector: function ( v, order ) { + + return this.set( v.x, v.y, v.z, order || this._order ); + + }, + reorder: function () { // WARNING: this discards revolution information -bhouston
false
Other
mrdoob
three.js
ea188856bf35610a2e968a79c9e4ea5136fd3397.json
fix bug when applying common.glsl
src/renderers/shaders/ShaderLib.js
@@ -1236,7 +1236,7 @@ THREE.ShaderLib = { "void main() {", - " vec4 worldPosition = transformNormal( position, modelMatrix );", + " vWorldPosition = transformNormal( position, modelMatrix );", " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", @@ -1286,7 +1286,7 @@ THREE.ShaderLib = { "void main() {", - " vec4 worldPosition = transformNormal( position, modelMatrix );", + " vWorldPosition = transformNormal( position, modelMatrix );", " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
false
Other
mrdoob
three.js
f6c07e8972d8446b58fe5f677883b22c4a88412a.json
Ignore intersections with crosshair
examples/vr_cubes.html
@@ -58,6 +58,7 @@ var vrEffect; var vrControls; + var cubes = []; var INTERSECTED; var radius = 100, theta = 0; var crosshair; @@ -115,6 +116,7 @@ object.scale.z = Math.random() + 0.5; scene.add( object ); + cubes.push( object ); } @@ -188,7 +190,7 @@ raycaster.setFromCamera( { x: 0, y: 0 }, camera ); - var intersects = raycaster.intersectObjects( scene.children ); + var intersects = raycaster.intersectObjects( cubes ); if ( intersects.length > 0 ) {
false
Other
mrdoob
three.js
764e9fa39b47a30f82e285b6893f7494a5dc1d30.json
Reset GL state before rendering sprites and lens
src/renderers/WebGLRenderer.js
@@ -1726,6 +1726,7 @@ THREE.WebGLRenderer = function ( parameters ) { // custom render plugins (post pass) + this.resetGLState(); spritePlugin.render( scene, camera ); lensFlarePlugin.render( scene, camera, _currentWidth, _currentHeight );
true
Other
mrdoob
three.js
764e9fa39b47a30f82e285b6893f7494a5dc1d30.json
Reset GL state before rendering sprites and lens
src/renderers/webgl/plugins/LensFlarePlugin.js
@@ -295,8 +295,9 @@ THREE.LensFlarePlugin = function ( renderer, flares ) { gl.useProgram( program ); - gl.enableVertexAttribArray( attributes.vertex ); - gl.enableVertexAttribArray( attributes.uv ); + renderer.state.disableUnusedAttributes(); + renderer.state.enableAttribute( attributes.vertex ); + renderer.state.enableAttribute( attributes.uv ); // loop through all lens flares to update their occlusion and positions // setup gl and common used attribs/unforms
true
Other
mrdoob
three.js
764e9fa39b47a30f82e285b6893f7494a5dc1d30.json
Reset GL state before rendering sprites and lens
src/renderers/webgl/plugins/SpritePlugin.js
@@ -98,8 +98,9 @@ THREE.SpritePlugin = function ( renderer, sprites ) { gl.useProgram( program ); - gl.enableVertexAttribArray( attributes.position ); - gl.enableVertexAttribArray( attributes.uv ); + renderer.state.disableUnusedAttributes(); + renderer.state.enableAttribute( attributes.position ); + renderer.state.enableAttribute( attributes.uv ); gl.disable( gl.CULL_FACE ); gl.enable( gl.BLEND );
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderChunk/common.glsl
@@ -4,6 +4,10 @@ #define LOG2 1.442695 #define EPSILON 1e-6 +#define square(a) a * a +#define saturate(a) clamp( a, 0.0, 1.0 ) +#define whiteCompliment(a) 1.0 - saturate( a ) + vec3 transformDirection( in vec3 normal, in mat4 matrix ) { return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz ); @@ -41,7 +45,7 @@ float calcLightAttenuation( float lightDistance, float cutoffDistance, float dec if ( decayExponent > 0.0 ) { - return pow( clamp( -lightDistance / cutoffDistance + 1.0, 0.0, 1.0 ), decayExponent ); + return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent ); } @@ -75,10 +79,10 @@ vec3 BRDF_BlinnPhong( in vec3 specularColor, in float shininess, in vec3 normal, vec3 halfDir = normalize( lightDir + viewDir ); - //float dotNL = clamp( dot( normal, lightDir ), 0.0, 1.0 ); - //float dotNV = clamp( dot( normal, viewDir ), 0.0, 1.0 ); - float dotNH = clamp( dot( normal, halfDir ), 0.0, 1.0 ); - float dotLH = clamp( dot( lightDir, halfDir ), 0.0, 1.0 ); + //float dotNL = saturate( dot( normal, lightDir ) ); + //float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotLH = saturate( dot( lightDir, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH );
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderChunk/envmap_fragment.glsl
@@ -34,7 +34,7 @@ #elif defined( ENVMAP_TYPE_EQUIREC ) vec2 sampleUV; - sampleUV.y = clamp( flipNormal * reflectVec.y * 0.5 + 0.5, 0.0, 1.0 ); + sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 ); sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5; vec4 envColor = texture2D( envMap, sampleUV );
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderChunk/fog_fragment.glsl
@@ -12,7 +12,7 @@ #ifdef FOG_EXP2 - float fogFactor = 1.0 - clamp( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ), 0.0, 1.0 ); + float fogFactor = whiteCompliment( exp2( - square( fogDensity ) * square( depth ) * LOG2 ) ); #else
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderChunk/helper_funcs.glsl
@@ -1,16 +0,0 @@ -float square( in float a ) { return a * a; } -vec2 square( in vec2 a ) { return a * a; } -vec3 square( in vec3 a ) { return a * a; } -vec4 square( in vec4 a ) { return a * a; } -float saturate( in float a ) { return clamp( a, 0.0, 1.0 ); } -vec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); } -vec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); } -vec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); } -float average( in float a ) { return a; } -float average( in vec2 a ) { return ( a.x + a.y) * 0.5; } -float average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; } -float average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; } -float whiteCompliment( in float a ) { return saturate( 1.0 - a ); } -vec2 whiteCompliment( in vec2 a ) { return saturate( 1.0 - a ); } -vec3 whiteCompliment( in vec3 a ) { return saturate( 1.0 - a ); } -vec4 whiteCompliment( in vec4 a ) { return saturate( 1.0 - a ); } \ No newline at end of file
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl
@@ -78,7 +78,7 @@ vec3 totalSpecularLight = vec3( 0.0 ); if ( spotEffect > spotLightAngleCos[ i ] ) { - spotEffect = clamp( pow( clamp( spotEffect, 0.0, 1.0 ), spotLightExponent[ i ] ), 0.0, 1.0 ); + spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) ); // attenuation
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl
@@ -59,13 +59,11 @@ varying vec3 vViewPosition; vec3 calcCosineTerm( in vec3 normal, in vec3 lightDir ) { - float dotProduct = dot( normal, lightDir ); - - vec3 cosineTerm = vec3( clamp( dotProduct, 0.0, 1.0 ) ); + vec3 cosineTerm = vec3( saturate( dot( normal, lightDir ) ) ); #ifdef WRAP_AROUND - vec3 cosineTermHalf = vec3( clamp( 0.5 * dotProduct + 0.5, 0.0, 1.0 ) ); + vec3 cosineTermHalf = vec3( saturate( 0.5 * dotProduct + 0.5 ) ); cosineTerm = mix( cosineTerm, cosineTermHalf, wrapRGB );
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
src/renderers/shaders/ShaderLib.js
@@ -737,7 +737,7 @@ THREE.ShaderLib = { // " gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );", "vec3 direction = normalize( vWorldPosition );", "vec2 sampleUV;", - "sampleUV.y = clamp( tFlip * direction.y * -0.5 + 0.5, 0.0, 1.0 );", + "sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );", "sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;", "gl_FragColor = texture2D( tEquirect, sampleUV );",
true
Other
mrdoob
three.js
1d163773f4910723d46378529eecc81d39dbe938.json
Add defines for favoured glsl functions
utils/build/includes/common.json
@@ -108,7 +108,6 @@ "src/renderers/shaders/ShaderChunk/envmap_vertex.glsl", "src/renderers/shaders/ShaderChunk/fog_fragment.glsl", "src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl", - "src/renderers/shaders/ShaderChunk/helper_funcs.glsl", "src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl", "src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl", "src/renderers/shaders/ShaderChunk/lights_lambert_pars_vertex.glsl",
true
Other
mrdoob
three.js
b0f0c3bd1ad3adf88cf333ecc610282682f52be5.json
Remove unnecessary semicolons
examples/js/Car.js
@@ -246,7 +246,7 @@ THREE.Car = function () { createCar(); - }; + } function createWheels ( geometry, materials ) { @@ -255,7 +255,7 @@ THREE.Car = function () { createCar(); - }; + } function createCar () { @@ -360,7 +360,7 @@ THREE.Car = function () { } - }; + } function quadraticEaseOut( k ) { return - k * ( k - 2 ); } function cubicEaseOut( k ) { return -- k * k * k + 1; }
true