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 | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_custom_attributes_points2.html | @@ -150,14 +150,14 @@
uniforms: {
amplitude: { value: 1.0 },
- color: { value: new THREE.Color( 0xffffff ) },
- texture: { value: texture }
+ color: { value: new THREE.Color( 0xffffff ) },
+ texture: { value: texture }
},
- vertexShader: document.getElementById( 'vertexshader' ).textContent,
+ vertexShader: document.getElementById( 'vertexshader' ).textContent,
fragmentShader: document.getElementById( 'fragmentshader' ).textContent,
- transparent: true
+ transparent: true
- });
+ } );
//
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_custom_attributes_points3.html | @@ -93,7 +93,7 @@
var renderer, scene, camera, stats;
- var object, uniforms, attributes;
+ var object;
var vertices1;
@@ -121,11 +121,11 @@
vertex.z = Math.random() * 2 - 1;
vertex.multiplyScalar( radius );
- if ( ( vertex.x > inner || vertex.x < -inner ) ||
- ( vertex.y > inner || vertex.y < -inner ) ||
- ( vertex.z > inner || vertex.z < -inner ) )
+ if ( ( vertex.x > inner || vertex.x < - inner ) ||
+ ( vertex.y > inner || vertex.y < - inner ) ||
+ ( vertex.z > inner || vertex.z < - inner ) )
- vertices.push( vertex );
+ vertices.push( vertex );
}
@@ -158,26 +158,26 @@
// side 1
- addGeo( geometry2, 0, 110, 110, 0 );
- addGeo( geometry2, 0, 110, -110, 0 );
- addGeo( geometry2, 0, -110, 110, 0 );
- addGeo( geometry2, 0, -110, -110, 0 );
+ addGeo( geometry2, 0, 110, 110, 0 );
+ addGeo( geometry2, 0, 110, - 110, 0 );
+ addGeo( geometry2, 0, - 110, 110, 0 );
+ addGeo( geometry2, 0, - 110, - 110, 0 );
// side 2
- addGeo( geometry2, 110, 110, 0, Math.PI/2 );
- addGeo( geometry2, 110, -110, 0, Math.PI/2 );
- addGeo( geometry2, -110, 110, 0, Math.PI/2 );
- addGeo( geometry2, -110, -110, 0, Math.PI/2 );
+ addGeo( geometry2, 110, 110, 0, Math.PI / 2 );
+ addGeo( geometry2, 110, - 110, 0, Math.PI / 2 );
+ addGeo( geometry2, - 110, 110, 0, Math.PI / 2 );
+ addGeo( geometry2, - 110, - 110, 0, Math.PI / 2 );
// corner edges
var geometry3 = new THREE.BoxGeometry( 0.1 * radius, radius * 1.2, 0.1 * radius, 5, 60, 5 );
- addGeo( geometry3, 110, 0, 110, 0 );
- addGeo( geometry3, 110, 0, -110, 0 );
- addGeo( geometry3, -110, 0, 110, 0 );
- addGeo( geometry3, -110, 0, -110, 0 );
+ addGeo( geometry3, 110, 0, 110, 0 );
+ addGeo( geometry3, 110, 0, - 110, 0 );
+ addGeo( geometry3, - 110, 0, 110, 0 );
+ addGeo( geometry3, - 110, 0, - 110, 0 );
var positions = new Float32Array( vertices.length * 3 );
var colors = new Float32Array( vertices.length * 3 );
@@ -222,13 +222,13 @@
uniforms: {
amplitude: { value: 1.0 },
- color: { value: new THREE.Color( 0xffffff ) },
- texture: { value: texture }
+ color: { value: new THREE.Color( 0xffffff ) },
+ texture: { value: texture }
},
- vertexShader: document.getElementById( 'vertexshader' ).textContent,
+ vertexShader: document.getElementById( 'vertexshader' ).textContent,
fragmentShader: document.getElementById( 'fragmentshader' ).textContent
- });
+ } );
//
@@ -284,7 +284,7 @@
if ( i < vertices1 ) {
- attributes.size.array[ i ] = Math.max(0, 26 + 32 * Math.sin( 0.1 * i + 0.6 * time ));
+ attributes.size.array[ i ] = Math.max( 0, 26 + 32 * Math.sin( 0.1 * i + 0.6 * time ) );
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_decals.html | @@ -46,7 +46,7 @@
var container = document.getElementById( 'container' );
var renderer, scene, camera, stats;
- var mesh, decal;
+ var mesh;
var raycaster;
var line;
@@ -80,13 +80,12 @@
var position = new THREE.Vector3();
var orientation = new THREE.Euler();
var size = new THREE.Vector3( 10, 10, 10 );
- var up = new THREE.Vector3( 0, 1, 0 );
var params = {
minScale: 10,
maxScale: 20,
rotate: true,
- clear: function() {
+ clear: function () {
removeDecals();
@@ -122,7 +121,7 @@
scene.add( light );
var light = new THREE.DirectionalLight( 0xccccff, 1 );
- light.position.set( -1, 0.75, -0.5 );
+ light.position.set( - 1, 0.75, - 0.5 );
scene.add( light );
var geometry = new THREE.BufferGeometry();
@@ -143,7 +142,7 @@
var moved = false;
- controls.addEventListener( 'change', function() {
+ controls.addEventListener( 'change', function () {
moved = true;
@@ -155,7 +154,7 @@
}, false );
- window.addEventListener( 'mouseup', function() {
+ window.addEventListener( 'mouseup', function () {
checkIntersection();
if ( ! moved && intersection.intersects ) shoot();
@@ -238,11 +237,11 @@
}
- function loadLeePerrySmith( callback ) {
+ function loadLeePerrySmith() {
var loader = new THREE.GLTFLoader();
- loader.load( 'models/gltf/LeePerrySmith/LeePerrySmith.glb', function( gltf ) {
+ loader.load( 'models/gltf/LeePerrySmith/LeePerrySmith.glb', function ( gltf ) {
mesh = gltf.scene.children[ 0 ];
mesh.material = new THREE.MeshPhongMaterial( {
@@ -282,7 +281,7 @@
function removeDecals() {
- decals.forEach( function( d ) {
+ decals.forEach( function ( d ) {
scene.remove( d );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_depth_texture.html | @@ -111,7 +111,7 @@
renderer = new THREE.WebGLRenderer( { canvas: document.querySelector( 'canvas' ) } );
- if ( !renderer.extensions.get( 'WEBGL_depth_texture' ) ) {
+ if ( ! renderer.extensions.get( 'WEBGL_depth_texture' ) ) {
supportsExtension = false;
document.querySelector( '#error' ).style.display = 'block';
@@ -158,7 +158,7 @@
}
- function setupPost () {
+ function setupPost() {
// Setup post processing stage
postCamera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
@@ -167,19 +167,19 @@
fragmentShader: document.querySelector( '#post-frag' ).textContent.trim(),
uniforms: {
cameraNear: { value: camera.near },
- cameraFar: { value: camera.far },
- tDiffuse: { value: target.texture },
- tDepth: { value: target.depthTexture }
+ cameraFar: { value: camera.far },
+ tDiffuse: { value: target.texture },
+ tDepth: { value: target.depthTexture }
}
- });
+ } );
var postPlane = new THREE.PlaneBufferGeometry( 2, 2 );
var postQuad = new THREE.Mesh( postPlane, postMaterial );
postScene = new THREE.Scene();
postScene.add( postQuad );
}
- function setupScene () {
+ function setupScene() {
//var diffuse = new THREE.TextureLoader().load( 'textures/brick_diffuse.jpg' );
//diffuse.wrapS = diffuse.wrapT = THREE.RepeatWrapping;
@@ -224,7 +224,7 @@
function animate() {
- if ( !supportsExtension ) return;
+ if ( ! supportsExtension ) return;
requestAnimationFrame( animate );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_effects_anaglyph.html | @@ -49,15 +49,10 @@
}
- var container;
+ var container, camera, scene, renderer, effect;
- var camera, scene, renderer, effect;
-
- var mesh, lightMesh, geometry;
var spheres = [];
- var directionalLight, pointLight;
-
var mouseX = 0;
var mouseY = 0;
@@ -140,7 +135,7 @@
}
- function onDocumentMouseMove(event) {
+ function onDocumentMouseMove( event ) {
mouseX = ( event.clientX - windowHalfX ) / 100;
mouseY = ( event.clientY - windowHalfY ) / 100; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_effects_parallaxbarrier.html | @@ -49,15 +49,10 @@
}
- var container;
+ var container, camera, scene, renderer, effect;
- var camera, scene, renderer, effect;
-
- var mesh, lightMesh, geometry;
var spheres = [];
- var directionalLight, pointLight;
-
var mouseX = 0;
var mouseY = 0;
@@ -140,7 +135,7 @@
}
- function onDocumentMouseMove(event) {
+ function onDocumentMouseMove( event ) {
mouseX = ( event.clientX - windowHalfX ) / 100;
mouseY = ( event.clientY - windowHalfY ) / 100; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_effects_peppersghost.html | @@ -63,94 +63,94 @@
function init() {
- container = document.createElement( 'div' );
- document.body.appendChild( container );
+ container = document.createElement( 'div' );
+ document.body.appendChild( container );
- camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
+ camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
- scene = new THREE.Scene();
+ scene = new THREE.Scene();
- group = new THREE.Group();
- scene.add( group );
+ group = new THREE.Group();
+ scene.add( group );
- // Cube
+ // Cube
- var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
- geometry = geometry.toNonIndexed(); // ensure unique vertices for each triangle
+ var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
+ geometry = geometry.toNonIndexed(); // ensure unique vertices for each triangle
- var position = geometry.attributes.position;
- var colors = [];
- var color = new THREE.Color();
+ var position = geometry.attributes.position;
+ var colors = [];
+ var color = new THREE.Color();
- // generate for each side of the cube a different color
+ // generate for each side of the cube a different color
- for ( var i = 0; i < position.count; i += 6 ) {
+ for ( var i = 0; i < position.count; i += 6 ) {
- color.setHex( Math.random() * 0xffffff );
+ color.setHex( Math.random() * 0xffffff );
- // first face
+ // first face
- colors.push( color.r, color.g, color.b );
- colors.push( color.r, color.g, color.b );
- colors.push( color.r, color.g, color.b );
+ colors.push( color.r, color.g, color.b );
+ colors.push( color.r, color.g, color.b );
+ colors.push( color.r, color.g, color.b );
- // second face
+ // second face
- colors.push( color.r, color.g, color.b );
- colors.push( color.r, color.g, color.b );
- colors.push( color.r, color.g, color.b );
+ colors.push( color.r, color.g, color.b );
+ colors.push( color.r, color.g, color.b );
+ colors.push( color.r, color.g, color.b );
- }
+ }
- geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+ geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
- var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.VertexColors, overdraw: 0.5 } );
+ var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.VertexColors, overdraw: 0.5 } );
- for ( var i = 0; i < 10; i ++ ) {
+ for ( var i = 0; i < 10; i ++ ) {
- var cube = new THREE.Mesh( geometry, material );
- cube.position.x = Math.random() * 2 - 1;
- cube.position.y = Math.random() * 2 - 1;
- cube.position.z = Math.random() * 2 - 1;
- cube.scale.multiplyScalar( Math.random() + 0.5 );
- group.add( cube );
+ var cube = new THREE.Mesh( geometry, material );
+ cube.position.x = Math.random() * 2 - 1;
+ cube.position.y = Math.random() * 2 - 1;
+ cube.position.z = Math.random() * 2 - 1;
+ cube.scale.multiplyScalar( Math.random() + 0.5 );
+ group.add( cube );
- }
+ }
- renderer = new THREE.WebGLRenderer();
- renderer.setPixelRatio( window.devicePixelRatio );
- container.appendChild( renderer.domElement );
+ renderer = new THREE.WebGLRenderer();
+ renderer.setPixelRatio( window.devicePixelRatio );
+ container.appendChild( renderer.domElement );
- effect = new THREE.PeppersGhostEffect( renderer );
- effect.setSize( window.innerWidth, window.innerHeight );
- effect.cameraDistance = 5;
+ effect = new THREE.PeppersGhostEffect( renderer );
+ effect.setSize( window.innerWidth, window.innerHeight );
+ effect.cameraDistance = 5;
- window.addEventListener( 'resize', onWindowResize, false );
+ window.addEventListener( 'resize', onWindowResize, false );
}
function onWindowResize() {
- camera.aspect = window.innerWidth / window.innerHeight;
- camera.updateProjectionMatrix();
+ camera.aspect = window.innerWidth / window.innerHeight;
+ camera.updateProjectionMatrix();
- effect.setSize( window.innerWidth, window.innerHeight );
+ effect.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
- requestAnimationFrame( animate );
+ requestAnimationFrame( animate );
- render();
+ render();
}
function render() {
- group.rotation.y += 0.01;
+ group.rotation.y += 0.01;
- effect.render( scene, camera );
+ effect.render( scene, camera );
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_effects_stereo.html | @@ -51,15 +51,10 @@
}
- var container;
+ var container, camera, scene, renderer, effect;
- var camera, scene, renderer, effect;
-
- var mesh, lightMesh, geometry;
var spheres = [];
- var directionalLight, pointLight;
-
var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometries.html | @@ -179,7 +179,7 @@
camera.lookAt( scene.position );
- scene.traverse( function( object ) {
+ scene.traverse( function ( object ) {
if ( object.isMesh === true ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_colors_lookuptable.html | @@ -104,11 +104,11 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
- renderer.setSize( window.innerWidth, window.innerHeight );
+ renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
window.addEventListener( 'resize', onWindowResize, false );
- window.addEventListener( 'keydown', onKeyDown, true);
+ window.addEventListener( 'keydown', onKeyDown, true );
}
@@ -139,9 +139,9 @@
}
- function loadModel ( colorMap, numberOfColors, legendLayout ) {
+ function loadModel( colorMap, numberOfColors, legendLayout ) {
- loader.load( 'models/json/pressure.json', function( geometry ) {
+ loader.load( 'models/json/pressure.json', function ( geometry ) {
geometry.center();
geometry.computeVertexNormals();
@@ -186,24 +186,24 @@
if ( legendLayout === 'horizontal' ) {
- legend = lut.setLegendOn( { 'layout':'horizontal', 'position': { 'x': 4, 'y': 0, 'z': 0 } } );
+ legend = lut.setLegendOn( { 'layout': 'horizontal', 'position': { 'x': 4, 'y': 0, 'z': 0 } } );
} else {
legend = lut.setLegendOn();
}
- scene.add ( legend );
+ scene.add( legend );
var labels = lut.setLegendLabels( { 'title': 'Pressure', 'um': 'Pa', 'ticks': 5 } );
- scene.add ( labels['title'] );
+ scene.add( labels[ 'title' ] );
for ( var i = 0; i < Object.keys( labels[ 'ticks' ] ).length; i ++ ) {
- scene.add ( labels[ 'ticks' ][ i ] );
- scene.add ( labels[ 'lines' ][ i ] );
+ scene.add( labels[ 'ticks' ][ i ] );
+ scene.add( labels[ 'lines' ][ i ] );
}
@@ -257,7 +257,7 @@
var index = maps.indexOf( colorMap ) >= maps.length - 1 ? 0 : maps.indexOf( colorMap ) + 1;
- colorMap = maps [ index ];
+ colorMap = maps[ index ];
loadModel( colorMap, numberOfColors, legendLayout );
@@ -267,9 +267,9 @@
var index = colorNumbers.indexOf( numberOfColors ) >= colorNumbers.length - 1 ? 0 : colorNumbers.indexOf( numberOfColors ) + 1;
- numberOfColors = colorNumbers [ index ];
+ numberOfColors = colorNumbers[ index ];
- loadModel( colorMap , numberOfColors, legendLayout );
+ loadModel( colorMap, numberOfColors, legendLayout );
} else if ( e.keyCode === 68 ) {
@@ -279,15 +279,15 @@
legendLayout = 'vertical';
- loadModel( colorMap , numberOfColors, legendLayout );
+ loadModel( colorMap, numberOfColors, legendLayout );
} else {
cleanScene();
legendLayout = lut.setLegendOff();
- loadModel( colorMap , numberOfColors, legendLayout );
+ loadModel( colorMap, numberOfColors, legendLayout );
}
@@ -299,7 +299,7 @@
lut.setLegendOff();
- if ( legendLayout === 'horizontal') {
+ if ( legendLayout === 'horizontal' ) {
legendLayout = 'vertical';
@@ -309,7 +309,7 @@
}
- loadModel( colorMap , numberOfColors, legendLayout );
+ loadModel( colorMap, numberOfColors, legendLayout );
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_convex.html | @@ -139,11 +139,11 @@
}
- function randomPoint() {
+ // function randomPoint() {
- return new THREE.Vector3( THREE.Math.randFloat( - 1, 1 ), THREE.Math.randFloat( - 1, 1 ), THREE.Math.randFloat( - 1, 1 ) );
+ // return new THREE.Vector3( THREE.Math.randFloat( - 1, 1 ), THREE.Math.randFloat( - 1, 1 ), THREE.Math.randFloat( - 1, 1 ) );
- }
+ // }
function onWindowResize() {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_dynamic.html | @@ -56,10 +56,9 @@
var camera, controls, scene, renderer, stats;
- var mesh, texture, geometry, material, clock;
+ var mesh, geometry, material, clock;
- var worldWidth = 128, worldDepth = 128,
- worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
+ var worldWidth = 128, worldDepth = 128;
init();
animate(); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_extrude_shapes.html | @@ -24,8 +24,6 @@
<script>
- var container;
-
var camera, scene, renderer, controls;
init();
@@ -67,11 +65,11 @@
//
var closedSpline = new THREE.CatmullRomCurve3( [
- new THREE.Vector3( -60, -100, 60 ),
- new THREE.Vector3( -60, 20, 60 ),
- new THREE.Vector3( -60, 120, 60 ),
- new THREE.Vector3( 60, 20, -60 ),
- new THREE.Vector3( 60, -100, -60 )
+ new THREE.Vector3( - 60, - 100, 60 ),
+ new THREE.Vector3( - 60, 20, 60 ),
+ new THREE.Vector3( - 60, 120, 60 ),
+ new THREE.Vector3( 60, 20, - 60 ),
+ new THREE.Vector3( 60, - 100, - 60 )
] );
closedSpline.curveType = 'catmullrom';
@@ -92,7 +90,7 @@
var a = 2 * i / count * Math.PI;
- pts.push( new THREE.Vector2 ( Math.cos( a ) * l, Math.sin( a ) * l ) );
+ pts.push( new THREE.Vector2( Math.cos( a ) * l, Math.sin( a ) * l ) );
}
@@ -118,7 +116,7 @@
}
- var randomSpline = new THREE.CatmullRomCurve3( randomPoints );
+ var randomSpline = new THREE.CatmullRomCurve3( randomPoints );
//
@@ -137,7 +135,7 @@
var a = i / numPts * Math.PI;
- pts.push( new THREE.Vector2 ( Math.cos( a ) * l, Math.sin( a ) * l ) );
+ pts.push( new THREE.Vector2( Math.cos( a ) * l, Math.sin( a ) * l ) );
}
@@ -160,7 +158,7 @@
depth: 20,
steps: 1,
bevelEnabled: true,
- bevelThickness : 2,
+ bevelThickness: 2,
bevelSize: 4,
bevelSegments: 1
}; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_extrude_shapes2.html | @@ -237,8 +237,10 @@
case 'T':
if ( activeCmd === 'T' ) {
+
x1 = 2 * x - x1;
y1 = 2 * y - y1;
+
}
nx = eatNum();
ny = eatNum();
@@ -292,7 +294,7 @@
if ( laf === sf ) norm = - norm;
x2 = norm * rx * y1 / ry;
- y2 = norm * -ry * x1 / rx;
+ y2 = norm * - ry * x1 / rx;
// step 3
@@ -338,7 +340,7 @@
return path;
- }
+ };
}
@@ -348,7 +350,7 @@
/// Part from g0v/twgeojson
/// Graphic Engine and Geo Data Init Functions
- var addGeoObject = function( group, svgObject ) {
+ var addGeoObject = function ( group, svgObject ) {
var paths = svgObject.paths;
var depths = svgObject.depths;
@@ -490,10 +492,10 @@
"M363.4600,128.3904 L366.6300,130.3829 L369.3732,129.3913 L369.5603,125.6695 L374.3989,125.1677 " +
"L370.8412,123.6440 L371.0684,118.8252 L369.0431,117.3157 L369.6882,115.7936 L367.8578,112.8749 " +
"L368.1217,110.4867 L366.5152,109.2554 L361.9554,112.3435 L358.1163,117.8678 L361.7218,120.2192 " +
- "L360.7261,126.3232 L362.8064,125.5221 Z"];
+ "L360.7261,126.3232 L362.8064,125.5221 Z" ];
obj.depths = [ 19, 20, 21 ];
- obj.colors = [ 0xC07000, 0xC08000, 0xC0A000 ];
+ obj.colors = [ 0xC07000, 0xC08000, 0xC0A000 ];
obj.center = { x: 365, y: 125 };
return obj; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_extrude_splines.html | @@ -48,28 +48,28 @@
var normal = new THREE.Vector3();
var pipeSpline = new THREE.CatmullRomCurve3( [
- new THREE.Vector3( 0, 10, -10 ), new THREE.Vector3( 10, 0, -10 ),
- new THREE.Vector3( 20, 0, 0 ), new THREE.Vector3( 30, 0, 10 ),
- new THREE.Vector3( 30, 0, 20 ), new THREE.Vector3( 20, 0, 30 ),
- new THREE.Vector3( 10, 0, 30 ), new THREE.Vector3( 0, 0, 30 ),
- new THREE.Vector3( -10, 10, 30 ), new THREE.Vector3( -10, 20, 30 ),
- new THREE.Vector3( 0, 30, 30 ), new THREE.Vector3( 10, 30, 30 ),
- new THREE.Vector3( 20, 30, 15 ), new THREE.Vector3( 10, 30, 10 ),
- new THREE.Vector3( 0, 30, 10 ), new THREE.Vector3( -10, 20, 10 ),
- new THREE.Vector3( -10, 10, 10 ), new THREE.Vector3( 0, 0, 10 ),
- new THREE.Vector3( 10, -10, 10 ), new THREE.Vector3( 20, -15, 10 ),
- new THREE.Vector3( 30, -15, 10 ), new THREE.Vector3( 40, -15, 10 ),
- new THREE.Vector3( 50, -15, 10 ), new THREE.Vector3( 60, 0, 10 ),
- new THREE.Vector3( 70, 0, 0 ), new THREE.Vector3( 80, 0, 0 ),
- new THREE.Vector3( 90, 0, 0 ), new THREE.Vector3( 100, 0, 0 )
+ new THREE.Vector3( 0, 10, - 10 ), new THREE.Vector3( 10, 0, - 10 ),
+ new THREE.Vector3( 20, 0, 0 ), new THREE.Vector3( 30, 0, 10 ),
+ new THREE.Vector3( 30, 0, 20 ), new THREE.Vector3( 20, 0, 30 ),
+ new THREE.Vector3( 10, 0, 30 ), new THREE.Vector3( 0, 0, 30 ),
+ new THREE.Vector3( - 10, 10, 30 ), new THREE.Vector3( - 10, 20, 30 ),
+ new THREE.Vector3( 0, 30, 30 ), new THREE.Vector3( 10, 30, 30 ),
+ new THREE.Vector3( 20, 30, 15 ), new THREE.Vector3( 10, 30, 10 ),
+ new THREE.Vector3( 0, 30, 10 ), new THREE.Vector3( - 10, 20, 10 ),
+ new THREE.Vector3( - 10, 10, 10 ), new THREE.Vector3( 0, 0, 10 ),
+ new THREE.Vector3( 10, - 10, 10 ), new THREE.Vector3( 20, - 15, 10 ),
+ new THREE.Vector3( 30, - 15, 10 ), new THREE.Vector3( 40, - 15, 10 ),
+ new THREE.Vector3( 50, - 15, 10 ), new THREE.Vector3( 60, 0, 10 ),
+ new THREE.Vector3( 70, 0, 0 ), new THREE.Vector3( 80, 0, 0 ),
+ new THREE.Vector3( 90, 0, 0 ), new THREE.Vector3( 100, 0, 0 )
] );
var sampleClosedSpline = new THREE.CatmullRomCurve3( [
- new THREE.Vector3( 0, -40, -40 ),
- new THREE.Vector3( 0, 40, -40 ),
- new THREE.Vector3( 0, 140, -40 ),
+ new THREE.Vector3( 0, - 40, - 40 ),
+ new THREE.Vector3( 0, 40, - 40 ),
+ new THREE.Vector3( 0, 140, - 40 ),
new THREE.Vector3( 0, 40, 40 ),
- new THREE.Vector3( 0, -40, 40 )
+ new THREE.Vector3( 0, - 40, 40 )
] );
sampleClosedSpline.curveType = 'catmullrom';
@@ -218,24 +218,52 @@
var gui = new dat.GUI( { width: 300 } );
var folderGeometry = gui.addFolder( 'Geometry' );
- folderGeometry.add( params, 'spline', Object.keys( splines ) ).onChange( function( value ) { addTube(); } );
- folderGeometry.add( params, 'scale', 2, 10 ).step( 2 ).onChange( function( value ) { setScale(); } );
- folderGeometry.add( params, 'extrusionSegments', 50, 500 ).step( 50 ).onChange( function( value ) { addTube(); } );
- folderGeometry.add( params, 'radiusSegments', 2, 12 ).step( 1 ).onChange( function( value ) { addTube(); } );
- folderGeometry.add( params, 'closed').onChange( function( value ) { addTube(); } );
+ folderGeometry.add( params, 'spline', Object.keys( splines ) ).onChange( function () {
+
+ addTube();
+
+ } );
+ folderGeometry.add( params, 'scale', 2, 10 ).step( 2 ).onChange( function () {
+
+ setScale();
+
+ } );
+ folderGeometry.add( params, 'extrusionSegments', 50, 500 ).step( 50 ).onChange( function () {
+
+ addTube();
+
+ } );
+ folderGeometry.add( params, 'radiusSegments', 2, 12 ).step( 1 ).onChange( function () {
+
+ addTube();
+
+ } );
+ folderGeometry.add( params, 'closed' ).onChange( function () {
+
+ addTube();
+
+ } );
folderGeometry.open();
var folderCamera = gui.addFolder( 'Camera' );
- folderCamera.add( params, 'animationView').onChange( function( value ) { animateCamera(); } );
- folderCamera.add( params, 'lookAhead').onChange( function( value ) { animateCamera(); } );
- folderCamera.add( params, 'cameraHelper').onChange( function( value ) { animateCamera(); } );
- folderCamera.open();
+ folderCamera.add( params, 'animationView' ).onChange( function () {
- // controls
+ animateCamera();
- var controls = new THREE.OrbitControls( camera, renderer.domElement );
+ } );
+ folderCamera.add( params, 'lookAhead' ).onChange( function () {
+
+ animateCamera();
+
+ } );
+ folderCamera.add( params, 'cameraHelper' ).onChange( function () {
- // event listener
+ animateCamera();
+
+ } );
+ folderCamera.open();
+
+ var controls = new THREE.OrbitControls( camera, renderer.domElement );
window.addEventListener( 'resize', onWindowResize, false );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_hierarchy.html | @@ -21,9 +21,7 @@
<script>
- var camera, scene, renderer, stats;
-
- var geometry, group;
+ var camera, scene, renderer, stats, group;
var mouseX = 0, mouseY = 0;
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_hierarchy2.html | @@ -21,9 +21,7 @@
<script>
- var camera, scene, renderer, stats;
-
- var geometry, root;
+ var camera, scene, renderer, stats, root;
var mouseX = 0, mouseY = 0;
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_minecraft.html | @@ -63,11 +63,10 @@
var camera, controls, scene, renderer;
- var mesh;
-
- var worldWidth = 128, worldDepth = 128,
- worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2,
- data = generateHeight( worldWidth, worldDepth );
+ var worldWidth = 128, worldDepth = 128;
+ var worldHalfWidth = worldWidth / 2;
+ var worldHalfDepth = worldDepth / 2;
+ var data = generateHeight( worldWidth, worldDepth );
var clock = new THREE.Clock();
@@ -121,7 +120,7 @@
nzGeometry.attributes.uv.array[ 1 ] = 0.5;
nzGeometry.attributes.uv.array[ 3 ] = 0.5;
nzGeometry.rotateY( Math.PI );
- nzGeometry.translate( 0, 0, -50 );
+ nzGeometry.translate( 0, 0, - 50 );
//
@@ -221,7 +220,7 @@
function generateHeight( width, height ) {
var data = [], perlin = new ImprovedNoise(),
- size = width * height, quality = 2, z = Math.random() * 100;
+ size = width * height, quality = 2, z = Math.random() * 100;
for ( var j = 0; j < 4; j ++ ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_minecraft_ao.html | @@ -59,17 +59,14 @@
}
- var fogExp2 = true;
-
var container, stats;
var camera, controls, scene, renderer;
- var mesh, mat;
-
- var worldWidth = 200, worldDepth = 200,
- worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2,
- data = generateHeight( worldWidth, worldDepth );
+ var worldWidth = 200, worldDepth = 200;
+ var worldHalfWidth = worldWidth / 2;
+ var worldHalfDepth = worldDepth / 2;
+ var data = generateHeight( worldWidth, worldDepth );
var clock = new THREE.Clock();
@@ -321,21 +318,10 @@
}
- function loadTexture( path, callback ) {
-
- var image = new Image();
-
- image.onload = function () { callback(); };
- image.src = path;
-
- return image;
-
- }
-
function generateHeight( width, height ) {
var data = [], perlin = new ImprovedNoise(),
- size = width * height, quality = 2, z = Math.random() * 100;
+ size = width * height, quality = 2, z = Math.random() * 100;
for ( var j = 0; j < 4; j ++ ) {
@@ -348,7 +334,7 @@
}
- quality *= 4
+ quality *= 4;
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_normals.html | @@ -133,7 +133,7 @@
};
gui = new dat.GUI( { width: 350 } );
- gui.add( options, 'Geometry', geometries ).onChange( function( value ) {
+ gui.add( options, 'Geometry', geometries ).onChange( function () {
addMesh();
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_nurbs.html | @@ -45,7 +45,6 @@
var mouseXOnMouseDown = 0;
var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
init();
animate();
@@ -131,29 +130,29 @@
var nsControlPoints = [
[
- new THREE.Vector4 ( -200, -200, 100, 1 ),
- new THREE.Vector4 ( -200, -100, -200, 1 ),
- new THREE.Vector4 ( -200, 100, 250, 1 ),
- new THREE.Vector4 ( -200, 200, -100, 1 )
+ new THREE.Vector4( - 200, - 200, 100, 1 ),
+ new THREE.Vector4( - 200, - 100, - 200, 1 ),
+ new THREE.Vector4( - 200, 100, 250, 1 ),
+ new THREE.Vector4( - 200, 200, - 100, 1 )
],
[
- new THREE.Vector4 ( 0, -200, 0, 1 ),
- new THREE.Vector4 ( 0, -100, -100, 5 ),
- new THREE.Vector4 ( 0, 100, 150, 5 ),
- new THREE.Vector4 ( 0, 200, 0, 1 )
+ new THREE.Vector4( 0, - 200, 0, 1 ),
+ new THREE.Vector4( 0, - 100, - 100, 5 ),
+ new THREE.Vector4( 0, 100, 150, 5 ),
+ new THREE.Vector4( 0, 200, 0, 1 )
],
[
- new THREE.Vector4 ( 200, -200, -100, 1 ),
- new THREE.Vector4 ( 200, -100, 200, 1 ),
- new THREE.Vector4 ( 200, 100, -250, 1 ),
- new THREE.Vector4 ( 200, 200, 100, 1 )
+ new THREE.Vector4( 200, - 200, - 100, 1 ),
+ new THREE.Vector4( 200, - 100, 200, 1 ),
+ new THREE.Vector4( 200, 100, - 250, 1 ),
+ new THREE.Vector4( 200, 200, 100, 1 )
]
];
var degree1 = 2;
var degree2 = 3;
- var knots1 = [0, 0, 0, 1, 1, 1];
- var knots2 = [0, 0, 0, 0, 1, 1, 1, 1];
- var nurbsSurface = new THREE.NURBSSurface(degree1, degree2, knots1, knots2, nsControlPoints);
+ var knots1 = [ 0, 0, 0, 1, 1, 1 ];
+ var knots2 = [ 0, 0, 0, 0, 1, 1, 1, 1 ];
+ var nurbsSurface = new THREE.NURBSSurface( degree1, degree2, knots1, knots2, nsControlPoints );
var map = new THREE.TextureLoader().load( 'textures/UV_Grid_Sm.jpg' );
map.wrapS = map.wrapT = THREE.RepeatWrapping;
@@ -195,7 +194,6 @@
function onWindowResize() {
windowHalfX = window.innerWidth / 2;
- windowHalfY = window.innerHeight / 2;
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@@ -227,15 +225,15 @@
}
- function onDocumentMouseUp( event ) {
+ function onDocumentMouseUp() {
document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
}
- function onDocumentMouseOut( event ) {
+ function onDocumentMouseOut() {
document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_shapes.html | @@ -171,19 +171,19 @@
californiaPts.push( new THREE.Vector2( 180, 640 ) );
californiaPts.push( new THREE.Vector2( 165, 680 ) );
californiaPts.push( new THREE.Vector2( 150, 670 ) );
- californiaPts.push( new THREE.Vector2( 90, 737 ) );
- californiaPts.push( new THREE.Vector2( 80, 795 ) );
- californiaPts.push( new THREE.Vector2( 50, 835 ) );
- californiaPts.push( new THREE.Vector2( 64, 870 ) );
- californiaPts.push( new THREE.Vector2( 60, 945 ) );
+ californiaPts.push( new THREE.Vector2( 90, 737 ) );
+ californiaPts.push( new THREE.Vector2( 80, 795 ) );
+ californiaPts.push( new THREE.Vector2( 50, 835 ) );
+ californiaPts.push( new THREE.Vector2( 64, 870 ) );
+ californiaPts.push( new THREE.Vector2( 60, 945 ) );
californiaPts.push( new THREE.Vector2( 300, 945 ) );
californiaPts.push( new THREE.Vector2( 300, 743 ) );
californiaPts.push( new THREE.Vector2( 600, 473 ) );
californiaPts.push( new THREE.Vector2( 626, 425 ) );
californiaPts.push( new THREE.Vector2( 600, 370 ) );
californiaPts.push( new THREE.Vector2( 610, 320 ) );
- for( var i = 0; i < californiaPts.length; i ++ ) californiaPts[ i ].multiplyScalar( 0.25 );
+ for ( var i = 0; i < californiaPts.length; i ++ ) californiaPts[ i ].multiplyScalar( 0.25 );
var californiaShape = new THREE.Shape( californiaPts );
@@ -346,17 +346,17 @@
// addShape( shape, color, x, y, z, rx, ry,rz, s );
- addShape( californiaShape, extrudeSettings, 0xf08000, -300, -100, 0, 0, 0, 0, 1 );
- addShape( triangleShape, extrudeSettings, 0x8080f0, -180, 0, 0, 0, 0, 0, 1 );
- addShape( roundedRectShape, extrudeSettings, 0x008000, -150, 150, 0, 0, 0, 0, 1 );
- addShape( trackShape, extrudeSettings, 0x008080, 200, -100, 0, 0, 0, 0, 1 );
- addShape( squareShape, extrudeSettings, 0x0040f0, 150, 100, 0, 0, 0, 0, 1 );
- addShape( heartShape, extrudeSettings, 0xf00000, 60, 100, 0, 0, 0, Math.PI, 1 );
- addShape( circleShape, extrudeSettings, 0x00f000, 120, 250, 0, 0, 0, 0, 1 );
- addShape( fishShape, extrudeSettings, 0x404040, - 60, 200, 0, 0, 0, 0, 1 );
- addShape( smileyShape, extrudeSettings, 0xf000f0, -200, 250, 0, 0, 0, Math.PI, 1 );
- addShape( arcShape, extrudeSettings, 0x804000, 150, 0, 0, 0, 0, 0, 1 );
- addShape( splineShape, extrudeSettings, 0x808080, - 50, -100, 0, 0, 0, 0, 1 );
+ addShape( californiaShape, extrudeSettings, 0xf08000, - 300, - 100, 0, 0, 0, 0, 1 );
+ addShape( triangleShape, extrudeSettings, 0x8080f0, - 180, 0, 0, 0, 0, 0, 1 );
+ addShape( roundedRectShape, extrudeSettings, 0x008000, - 150, 150, 0, 0, 0, 0, 1 );
+ addShape( trackShape, extrudeSettings, 0x008080, 200, - 100, 0, 0, 0, 0, 1 );
+ addShape( squareShape, extrudeSettings, 0x0040f0, 150, 100, 0, 0, 0, 0, 1 );
+ addShape( heartShape, extrudeSettings, 0xf00000, 60, 100, 0, 0, 0, Math.PI, 1 );
+ addShape( circleShape, extrudeSettings, 0x00f000, 120, 250, 0, 0, 0, 0, 1 );
+ addShape( fishShape, extrudeSettings, 0x404040, - 60, 200, 0, 0, 0, 0, 1 );
+ addShape( smileyShape, extrudeSettings, 0xf000f0, - 200, 250, 0, 0, 0, Math.PI, 1 );
+ addShape( arcShape, extrudeSettings, 0x804000, 150, 0, 0, 0, 0, 0, 1 );
+ addShape( splineShape, extrudeSettings, 0x808080, - 50, - 100, 0, 0, 0, 0, 1 );
addLineShape( arcShape.holes[ 0 ], 0x804000, 150, 0, 0, 0, 0, 0, 1 );
@@ -418,15 +418,15 @@
}
- function onDocumentMouseUp( event ) {
+ function onDocumentMouseUp() {
document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
}
- function onDocumentMouseOut( event ) {
+ function onDocumentMouseOut() {
document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_spline_editor.html | @@ -53,12 +53,11 @@
};
var container, stats;
- var camera, scene, renderer, spotlight;
- var splineHelperObjects = [], splineOutline;
+ var camera, scene, renderer;
+ var splineHelperObjects = [];
var splinePointsLength = 4;
var positions = [];
var point = new THREE.Vector3();
- var options;
var geometry = new THREE.BoxBufferGeometry( 20, 20, 20 );
var transformControl;
@@ -96,18 +95,17 @@
light.position.set( 0, 1500, 200 );
light.castShadow = true;
light.shadow = new THREE.LightShadow( new THREE.PerspectiveCamera( 70, 1, 200, 2000 ) );
- light.shadow.bias = -0.000222;
+ light.shadow.bias = - 0.000222;
light.shadow.mapSize.width = 1024;
light.shadow.mapSize.height = 1024;
scene.add( light );
- spotlight = light;
var planeGeometry = new THREE.PlaneBufferGeometry( 2000, 2000 );
planeGeometry.rotateX( - Math.PI / 2 );
var planeMaterial = new THREE.ShadowMaterial( { opacity: 0.2 } );
var plane = new THREE.Mesh( planeGeometry, planeMaterial );
- plane.position.y = -200;
+ plane.position.y = - 200;
plane.receiveShadow = true;
scene.add( plane );
@@ -133,10 +131,12 @@
var gui = new dat.GUI();
gui.add( params, 'uniform' );
- gui.add( params, 'tension', 0, 1 ).step( 0.01 ).onChange( function( value ) {
+ gui.add( params, 'tension', 0, 1 ).step( 0.01 ).onChange( function ( value ) {
+
splines.uniform.tension = value;
updateSplineOutline();
- });
+
+ } );
gui.add( params, 'centripetal' );
gui.add( params, 'chordal' );
gui.add( params, 'addPoint' );
@@ -149,13 +149,13 @@
controls.damping = 0.2;
controls.addEventListener( 'change', render );
- controls.addEventListener( 'start', function() {
+ controls.addEventListener( 'start', function () {
cancelHideTransorm();
} );
- controls.addEventListener( 'end', function() {
+ controls.addEventListener( 'end', function () {
delayHideTransform();
@@ -164,30 +164,32 @@
transformControl = new THREE.TransformControls( camera, renderer.domElement );
transformControl.addEventListener( 'change', render );
transformControl.addEventListener( 'dragging-changed', function ( event ) {
- controls.enabled = !event.value
- } );
+
+ controls.enabled = ! event.value;
+
+ } );
scene.add( transformControl );
// Hiding transform situation is a little in a mess :()
- transformControl.addEventListener( 'change', function( e ) {
+ transformControl.addEventListener( 'change', function () {
cancelHideTransorm();
} );
- transformControl.addEventListener( 'mouseDown', function( e ) {
+ transformControl.addEventListener( 'mouseDown', function () {
cancelHideTransorm();
} );
- transformControl.addEventListener( 'mouseUp', function( e ) {
+ transformControl.addEventListener( 'mouseUp', function () {
delayHideTransform();
} );
- transformControl.addEventListener( 'objectChange', function( e ) {
+ transformControl.addEventListener( 'objectChange', function () {
updateSplineOutline();
@@ -202,7 +204,7 @@
} );
- dragcontrols.addEventListener( 'hoveroff', function ( event ) {
+ dragcontrols.addEventListener( 'hoveroff', function () {
delayHideTransform();
@@ -219,11 +221,11 @@
function hideTransform() {
- hiding = setTimeout( function() {
+ hiding = setTimeout( function () {
transformControl.detach( transformControl.object );
- }, 2500 )
+ }, 2500 );
}
@@ -259,7 +261,7 @@
curve.mesh = new THREE.Line( geometry.clone(), new THREE.LineBasicMaterial( {
color: 0xff0000,
opacity: 0.35
- } ) );
+ } ) );
curve.mesh.castShadow = true;
splines.uniform = curve;
@@ -268,7 +270,7 @@
curve.mesh = new THREE.Line( geometry.clone(), new THREE.LineBasicMaterial( {
color: 0x00ff00,
opacity: 0.35
- } ) );
+ } ) );
curve.mesh.castShadow = true;
splines.centripetal = curve;
@@ -277,7 +279,7 @@
curve.mesh = new THREE.Line( geometry.clone(), new THREE.LineBasicMaterial( {
color: 0x0000ff,
opacity: 0.35
- } ) );
+ } ) );
curve.mesh.castShadow = true;
splines.chordal = curve;
@@ -289,9 +291,9 @@
}
load( [ new THREE.Vector3( 289.76843686945404, 452.51481137238443, 56.10018915737797 ),
- new THREE.Vector3( -53.56300074753207, 171.49711742836848, -14.495472686253045 ),
- new THREE.Vector3( -91.40118730204415, 176.4306956436485, -6.958271935582161 ),
- new THREE.Vector3( -383.785318791128, 491.1365363371675, 47.869296953772746 ) ] );
+ new THREE.Vector3( - 53.56300074753207, 171.49711742836848, - 14.495472686253045 ),
+ new THREE.Vector3( - 91.40118730204415, 176.4306956436485, - 6.958271935582161 ),
+ new THREE.Vector3( - 383.785318791128, 491.1365363371675, 47.869296953772746 ) ] );
}
@@ -356,7 +358,7 @@
for ( var i = 0; i < ARC_SEGMENTS; i ++ ) {
- var t = i / ( ARC_SEGMENTS - 1 );
+ var t = i / ( ARC_SEGMENTS - 1 );
spline.getPoint( t, point );
position.setXYZ( i, point.x, point.y, point.z );
@@ -375,7 +377,7 @@
for ( var i = 0; i < splinePointsLength; i ++ ) {
var p = splineHelperObjects[ i ].position;
- strplace.push( 'new THREE.Vector3({0}, {1}, {2})'.format( p.x, p.y, p.z ) )
+ strplace.push( 'new THREE.Vector3({0}, {1}, {2})'.format( p.x, p.y, p.z ) );
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_teapot.html | @@ -50,7 +50,7 @@
////////////////////////////////////////////////////////////////////////////////
// Utah/Newell Teapot demo
////////////////////////////////////////////////////////////////////////////////
- /*global THREE, WEBGL, container, dat, window */
+ /*global THREE, WEBGL, dat, window */
if ( WEBGL.isWebGLAvailable() === false ) {
@@ -63,10 +63,9 @@
var effectController;
var teapotSize = 400;
var ambientLight, light;
- var skybox;
- var tess = -1; // force initialization
- var bBottom ;
+ var tess = - 1; // force initialization
+ var bBottom;
var bLid;
var bBody;
var bFitLid;
@@ -93,7 +92,7 @@
// CAMERA
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 80000 );
- camera.position.set( -600, 550, 1300 );
+ camera.position.set( - 600, 550, 1300 );
// LIGHTS
ambientLight = new THREE.AmbientLight( 0x333333 ); // 0.2
@@ -135,7 +134,7 @@
var materialColor = new THREE.Color();
materialColor.setRGB( 1.0, 1.0, 1.0 );
- wireMaterial = new THREE.MeshBasicMaterial( { color: 0xFFFFFF, wireframe: true } ) ;
+ wireMaterial = new THREE.MeshBasicMaterial( { color: 0xFFFFFF, wireframe: true } );
flatMaterial = new THREE.MeshPhongMaterial( { color: materialColor, specular: 0x000000, flatShading: true, side: THREE.DoubleSide } );
@@ -185,13 +184,13 @@
ks: 0.2,
metallic: true,
- hue: 0.121,
+ hue: 0.121,
saturation: 0.73,
- lightness: 0.66,
+ lightness: 0.66,
- lhue: 0.04,
+ lhue: 0.04,
lsaturation: 0.01, // non-zero so that fractions will be shown
- llightness: 1.0,
+ llightness: 1.0,
// bizarrely, if you initialize these with negative numbers, the sliders
// will not show any decimal places.
@@ -241,9 +240,9 @@
h = gui.addFolder( "Light direction" );
- h.add( effectController, "lx", -1.0, 1.0, 0.025 ).name( "x" ).onChange( render );
- h.add( effectController, "ly", -1.0, 1.0, 0.025 ).name( "y" ).onChange( render );
- h.add( effectController, "lz", -1.0, 1.0, 0.025 ).name( "z" ).onChange( render );
+ h.add( effectController, "lx", - 1.0, 1.0, 0.025 ).name( "x" ).onChange( render );
+ h.add( effectController, "ly", - 1.0, 1.0, 0.025 ).name( "y" ).onChange( render );
+ h.add( effectController, "lz", - 1.0, 1.0, 0.025 ).name( "z" ).onChange( render );
h = gui.addFolder( "Tessellation control" );
h.add( effectController, "newTess", [ 2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50 ] ).name( "Tessellation Level" ).onChange( render );
@@ -270,8 +269,7 @@
effectController.body !== bBody ||
effectController.fitLid !== bFitLid ||
effectController.nonblinn !== bNonBlinn ||
- effectController.newShading !== shading )
- {
+ effectController.newShading !== shading ) {
tess = effectController.newTess;
bBottom = effectController.bottom;
@@ -291,15 +289,12 @@
texturedMaterial.shininess = effectController.shininess;
diffuseColor.setHSL( effectController.hue, effectController.saturation, effectController.lightness );
- if ( effectController.metallic )
- {
+ if ( effectController.metallic ) {
// make colors match to give a more metallic look
specularColor.copy( diffuseColor );
- }
- else
- {
+ } else {
// more of a plastic look
specularColor.setRGB( 1, 1, 1 );
@@ -358,10 +353,10 @@
teapot = new THREE.Mesh(
teapotGeometry,
shading === "wireframe" ? wireMaterial : (
- shading === "flat" ? flatMaterial : (
- shading === "smooth" ? gouraudMaterial : (
- shading === "glossy" ? phongMaterial : (
- shading === "textured" ? texturedMaterial : reflectiveMaterial ) ) ) ) ); // if no match, pick Phong
+ shading === "flat" ? flatMaterial : (
+ shading === "smooth" ? gouraudMaterial : (
+ shading === "glossy" ? phongMaterial : (
+ shading === "textured" ? texturedMaterial : reflectiveMaterial ) ) ) ) ); // if no match, pick Phong
scene.add( teapot );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_terrain.html | @@ -58,7 +58,7 @@
var mesh, texture;
var worldWidth = 256, worldDepth = 256,
- worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
+ worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
var clock = new THREE.Clock();
@@ -131,13 +131,13 @@
function generateHeight( width, height ) {
var size = width * height, data = new Uint8Array( size ),
- perlin = new ImprovedNoise(), quality = 1, z = Math.random() * 100;
+ perlin = new ImprovedNoise(), quality = 1, z = Math.random() * 100;
for ( var j = 0; j < 4; j ++ ) {
for ( var i = 0; i < size; i ++ ) {
- var x = i % width, y = ~~ ( i / width );
+ var x = i % width, y = ~ ~ ( i / width );
data[ i ] += Math.abs( perlin.noise( x / quality, y / quality, z ) * quality * 1.75 );
}
@@ -182,6 +182,7 @@
imageData[ i ] = ( 96 + shade * 128 ) * ( 0.5 + data[ j ] * 0.007 );
imageData[ i + 1 ] = ( 32 + shade * 96 ) * ( 0.5 + data[ j ] * 0.007 );
imageData[ i + 2 ] = ( shade * 96 ) * ( 0.5 + data[ j ] * 0.007 );
+
}
context.putImageData( image, 0, 0 );
@@ -201,7 +202,7 @@
for ( var i = 0, l = imageData.length; i < l; i += 4 ) {
- var v = ~~ ( Math.random() * 5 );
+ var v = ~ ~ ( Math.random() * 5 );
imageData[ i ] += v;
imageData[ i + 1 ] += v; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_terrain_fog.html | @@ -23,7 +23,6 @@
}
a {
-
color: #a06851;
}
@@ -56,8 +55,9 @@
var mesh, texture;
- var worldWidth = 256, worldDepth = 256,
- worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
+ var worldWidth = 256, worldDepth = 256;
+ var worldHalfWidth = worldWidth / 2;
+ var worldHalfDepth = worldDepth / 2;
var clock = new THREE.Clock();
@@ -132,13 +132,13 @@
function generateHeight( width, height ) {
var size = width * height, data = new Uint8Array( size ),
- perlin = new ImprovedNoise(), quality = 1, z = Math.random() * 100;
+ perlin = new ImprovedNoise(), quality = 1, z = Math.random() * 100;
for ( var j = 0; j < 4; j ++ ) {
for ( var i = 0; i < size; i ++ ) {
- var x = i % width, y = ~~ ( i / width );
+ var x = i % width, y = ~ ~ ( i / width );
data[ i ] += Math.abs( perlin.noise( x / quality, y / quality, z ) * quality * 1.75 );
}
@@ -203,7 +203,7 @@
for ( var i = 0, l = imageData.length; i < l; i += 4 ) {
- var v = ~~ ( Math.random() * 5 );
+ var v = ~ ~ ( Math.random() * 5 );
imageData[ i ] += v;
imageData[ i + 1 ] += v; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_terrain_raycast.html | @@ -23,7 +23,6 @@
}
a {
-
color: #a06851;
}
@@ -59,8 +58,6 @@
var worldWidth = 256, worldDepth = 256,
worldHalfWidth = worldWidth / 2, worldHalfDepth = worldDepth / 2;
- var clock = new THREE.Clock();
-
var helper;
var raycaster = new THREE.Raycaster(); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_geometry_text.html | @@ -52,7 +52,7 @@
THREE.Cache.enabled = true;
- var container, stats, permalink, hex, color;
+ var container, stats, permalink, hex;
var camera, cameraTarget, scene, renderer;
@@ -70,7 +70,6 @@
bevelThickness = 2,
bevelSize = 1.5,
- bevelSegments = 3,
bevelEnabled = true,
font = undefined,
@@ -100,8 +99,8 @@
var reverseFontMap = [];
var reverseWeightMap = [];
- for ( var i in fontMap ) reverseFontMap[ fontMap[i] ] = i;
- for ( var i in weightMap ) reverseWeightMap[ weightMap[i] ] = i;
+ for ( var i in fontMap ) reverseFontMap[ fontMap[ i ] ] = i;
+ for ( var i in weightMap ) reverseWeightMap[ weightMap[ i ] ] = i;
var targetRotation = 0;
var targetRotationOnMouseDown = 0;
@@ -110,7 +109,6 @@
var mouseXOnMouseDown = 0;
var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
var fontIndex = 1;
@@ -161,11 +159,11 @@
if ( hash.length !== 0 ) {
- var colorhash = hash.substring( 0, 6 );
- var fonthash = hash.substring( 6, 7 );
+ var colorhash = hash.substring( 0, 6 );
+ var fonthash = hash.substring( 6, 7 );
var weighthash = hash.substring( 7, 8 );
- var bevelhash = hash.substring( 8, 9 );
- var texthash = hash.substring( 10 );
+ var bevelhash = hash.substring( 8, 9 );
+ var texthash = hash.substring( 10 );
hex = colorhash;
pointLight.color.setHex( parseInt( colorhash, 16 ) );
@@ -226,7 +224,7 @@
document.addEventListener( 'keypress', onDocumentKeyPress, false );
document.addEventListener( 'keydown', onDocumentKeyDown, false );
- document.getElementById( "color" ).addEventListener( 'click', function() {
+ document.getElementById( "color" ).addEventListener( 'click', function () {
pointLight.color.setHSL( Math.random(), 1, 0.5 );
hex = decimalToHex( pointLight.color.getHex() );
@@ -235,7 +233,7 @@
}, false );
- document.getElementById( "font" ).addEventListener( 'click', function() {
+ document.getElementById( "font" ).addEventListener( 'click', function () {
fontIndex ++;
@@ -246,7 +244,7 @@
}, false );
- document.getElementById( "weight" ).addEventListener( 'click', function() {
+ document.getElementById( "weight" ).addEventListener( 'click', function () {
if ( fontWeight === "bold" ) {
@@ -262,9 +260,9 @@
}, false );
- document.getElementById( "bevel" ).addEventListener( 'click', function() {
+ document.getElementById( "bevel" ).addEventListener( 'click', function () {
- bevelEnabled = !bevelEnabled;
+ bevelEnabled = ! bevelEnabled;
refreshText();
@@ -279,7 +277,6 @@
function onWindowResize() {
windowHalfX = window.innerWidth / 2;
- windowHalfY = window.innerHeight / 2;
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@@ -379,7 +376,7 @@
bevelSize: bevelSize,
bevelEnabled: bevelEnabled
- });
+ } );
textGeo.computeBoundingBox();
textGeo.computeVertexNormals();
@@ -426,7 +423,7 @@
}
- var centerOffset = -0.5 * ( textGeo.boundingBox.max.x - textGeo.boundingBox.min.x );
+ var centerOffset = - 0.5 * ( textGeo.boundingBox.max.x - textGeo.boundingBox.min.x );
textGeo = new THREE.BufferGeometry().fromGeometry( textGeo );
@@ -446,7 +443,7 @@
textMesh2 = new THREE.Mesh( textGeo, materials );
textMesh2.position.x = centerOffset;
- textMesh2.position.y = -hover;
+ textMesh2.position.y = - hover;
textMesh2.position.z = height;
textMesh2.rotation.x = Math.PI;
@@ -465,7 +462,7 @@
group.remove( textMesh1 );
if ( mirror ) group.remove( textMesh2 );
- if ( !text ) return;
+ if ( ! text ) return;
createText();
@@ -492,15 +489,15 @@
}
- function onDocumentMouseUp( event ) {
+ function onDocumentMouseUp() {
document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
}
- function onDocumentMouseOut( event ) {
+ function onDocumentMouseOut() {
document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
document.removeEventListener( 'mouseup', onDocumentMouseUp, false ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_gpgpu_birds.html | @@ -329,7 +329,7 @@
}
var hash = document.location.hash.substr( 1 );
- if (hash) hash = parseInt(hash, 0);
+ if ( hash ) hash = parseInt( hash, 0 );
/* TEXTURE WIDTH FOR SIMULATION */
var WIDTH = hash || 32;
@@ -360,57 +360,61 @@
var v = 0;
function verts_push() {
- for (var i=0; i < arguments.length; i++) {
- vertices.array[v++] = arguments[i];
- }
- }
+
+ for ( var i = 0; i < arguments.length; i ++ ) {
+
+ vertices.array[ v ++ ] = arguments[ i ];
+
+ }
+
+ }
var wingsSpan = 20;
- for (var f = 0; f<BIRDS; f++ ) {
+ for ( var f = 0; f < BIRDS; f ++ ) {
// Body
verts_push(
- 0, -0, -20,
- 0, 4, -20,
+ 0, - 0, - 20,
+ 0, 4, - 20,
0, 0, 30
);
// Left Wing
verts_push(
- 0, 0, -15,
- -wingsSpan, 0, 0,
+ 0, 0, - 15,
+ - wingsSpan, 0, 0,
0, 0, 15
);
// Right Wing
verts_push(
0, 0, 15,
wingsSpan, 0, 0,
- 0, 0, -15
+ 0, 0, - 15
);
}
- for( var v = 0; v < triangles * 3; v++ ) {
+ for ( var v = 0; v < triangles * 3; v ++ ) {
- var i = ~~(v / 3);
- var x = (i % WIDTH) / WIDTH;
- var y = ~~(i / WIDTH) / WIDTH;
+ var i = ~ ~ ( v / 3 );
+ var x = ( i % WIDTH ) / WIDTH;
+ var y = ~ ~ ( i / WIDTH ) / WIDTH;
var c = new THREE.Color(
0x444444 +
- ~~(v / 9) / BIRDS * 0x666666
+ ~ ~ ( v / 9 ) / BIRDS * 0x666666
);
birdColors.array[ v * 3 + 0 ] = c.r;
birdColors.array[ v * 3 + 1 ] = c.g;
birdColors.array[ v * 3 + 2 ] = c.b;
- references.array[ v * 2 ] = x;
+ references.array[ v * 2 ] = x;
references.array[ v * 2 + 1 ] = y;
- birdVertex.array[ v ] = v % 9;
+ birdVertex.array[ v ] = v % 9;
}
@@ -422,29 +426,33 @@
var container, stats;
- var camera, scene, renderer, geometry, i, h, color;
+ var camera, scene, renderer, i;
var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
var BOUNDS = 800, BOUNDS_HALF = BOUNDS / 2;
- document.getElementById('birds').innerText = BIRDS;
+ document.getElementById( 'birds' ).innerText = BIRDS;
+
+ function change( n ) {
- function change(n) {
location.hash = n;
location.reload();
return false;
- }
+
+}
var options = '';
- for (i=1; i<7; i++) {
- var j = Math.pow(2, i);
- options += '<a href="#" onclick="return change(' + j + ')">' + (j * j) + '</a> ';
- }
- document.getElementById('options').innerHTML = options;
+ for ( i = 1; i < 7; i ++ ) {
+
+ var j = Math.pow( 2, i );
+ options += '<a href="#" onclick="return change(' + j + ')">' + ( j * j ) + '</a> ';
+
+}
+ document.getElementById( 'options' ).innerHTML = options;
var last = performance.now();
@@ -500,7 +508,7 @@
freedom: 0.75
};
- var valuesChanger = function() {
+ var valuesChanger = function () {
velocityUniforms.seperationDistance.value = effectController.seperation;
velocityUniforms.alignmentDistance.value = effectController.alignment;
@@ -558,8 +566,10 @@
var error = gpuCompute.init();
if ( error !== null ) {
+
console.error( error );
- }
+
+ }
}
@@ -578,19 +588,19 @@
// ShaderMaterial
var material = new THREE.ShaderMaterial( {
- uniforms: birdUniforms,
- vertexShader: document.getElementById( 'birdVS' ).textContent,
+ uniforms: birdUniforms,
+ vertexShader: document.getElementById( 'birdVS' ).textContent,
fragmentShader: document.getElementById( 'birdFS' ).textContent,
side: THREE.DoubleSide
- });
+ } );
var birdMesh = new THREE.Mesh( geometry, material );
birdMesh.rotation.y = Math.PI / 2;
birdMesh.matrixAutoUpdate = false;
birdMesh.updateMatrix();
- scene.add(birdMesh);
+ scene.add( birdMesh );
}
@@ -692,9 +702,9 @@
function render() {
var now = performance.now();
- var delta = (now - last) / 1000;
+ var delta = ( now - last ) / 1000;
- if (delta > 1) delta = 1; // safety cap on large deltas
+ if ( delta > 1 ) delta = 1; // safety cap on large deltas
last = now;
positionUniforms.time.value = now; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_gpgpu_protoplanet.html | @@ -284,7 +284,7 @@
var WIDTH = hash || ( ( isIE || isEdge ) ? 4 : 64 );
var container, stats;
- var camera, scene, renderer, geometry, controls;
+ var camera, scene, renderer, geometry;
var PARTICLES = WIDTH * WIDTH;
@@ -298,10 +298,9 @@
}
-
var options = '';
- for ( var i = 1; i < 8; i++ ) {
+ for ( var i = 1; i < 8; i ++ ) {
var j = Math.pow( 2, i );
options += '<a href="#" onclick="return change(' + j + ')">' + ( j * j ) + '</a> ';
@@ -319,7 +318,6 @@
var gpuCompute;
var velocityVariable;
var positionVariable;
- var positionUniforms;
var velocityUniforms;
var particleUniforms;
var effectController;
@@ -343,7 +341,7 @@
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
- controls = new THREE.OrbitControls( camera, renderer.domElement );
+ var controls = new THREE.OrbitControls( camera, renderer.domElement );
effectController = {
// Can be changed dynamically
@@ -390,7 +388,6 @@
gpuCompute.setVariableDependencies( velocityVariable, [ positionVariable, velocityVariable ] );
gpuCompute.setVariableDependencies( positionVariable, [ positionVariable, velocityVariable ] );
- positionUniforms = positionVariable.material.uniforms;
velocityUniforms = velocityVariable.material.uniforms;
velocityUniforms.gravityConstant = { value: 0.0 };
@@ -427,23 +424,23 @@
var positions = new Float32Array( PARTICLES * 3 );
var p = 0;
- for ( var i = 0; i < PARTICLES; i++ ) {
+ for ( var i = 0; i < PARTICLES; i ++ ) {
- positions[ p++ ] = ( Math.random() * 2 - 1 ) * effectController.radius;
- positions[ p++ ] = 0; //( Math.random() * 2 - 1 ) * effectController.radius;
- positions[ p++ ] = ( Math.random() * 2 - 1 ) * effectController.radius;
+ positions[ p ++ ] = ( Math.random() * 2 - 1 ) * effectController.radius;
+ positions[ p ++ ] = 0; //( Math.random() * 2 - 1 ) * effectController.radius;
+ positions[ p ++ ] = ( Math.random() * 2 - 1 ) * effectController.radius;
}
var uvs = new Float32Array( PARTICLES * 2 );
p = 0;
- for ( var j = 0; j < WIDTH; j++ ) {
+ for ( var j = 0; j < WIDTH; j ++ ) {
- for ( var i = 0; i < WIDTH; i++ ) {
+ for ( var i = 0; i < WIDTH; i ++ ) {
- uvs[ p++ ] = i / ( WIDTH - 1 );
- uvs[ p++ ] = j / ( WIDTH - 1 );
+ uvs[ p ++ ] = i / ( WIDTH - 1 );
+ uvs[ p ++ ] = j / ( WIDTH - 1 );
}
@@ -461,8 +458,8 @@
// ShaderMaterial
var material = new THREE.ShaderMaterial( {
- uniforms: particleUniforms,
- vertexShader: document.getElementById( 'particleVertexShader' ).textContent,
+ uniforms: particleUniforms,
+ vertexShader: document.getElementById( 'particleVertexShader' ).textContent,
fragmentShader: document.getElementById( 'particleFragmentShader' ).textContent
} );
@@ -573,7 +570,11 @@
folder2.add( effectController, "randVelocity", 0.0, 50.0, 0.1 );
var buttonRestart = {
- restartSimulation: function() { restartSimulation(); }
+ restartSimulation: function () {
+
+ restartSimulation();
+
+ }
};
folder2.add( buttonRestart, 'restartSimulation' ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_gpgpu_water.html | @@ -46,7 +46,6 @@
<script src="js/GPUComputationRenderer.js"></script>
-
<!-- This is the 'compute shader' for the water heightmap: -->
<script id="heightmapFragmentShader" type="x-shader/x-fragment">
@@ -212,14 +211,12 @@
// Texture width for simulation
var WIDTH = hash || 128;
- var NUM_TEXELS = WIDTH * WIDTH;
// Water size in system units
var BOUNDS = 512;
- var BOUNDS_HALF = BOUNDS * 0.5;
var container, stats;
- var camera, scene, renderer, controls;
+ var camera, scene, renderer;
var mouseMoved = false;
var mouseCoords = new THREE.Vector2();
var raycaster = new THREE.Raycaster();
@@ -233,24 +230,24 @@
var simplex = new SimplexNoise();
- var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
-
document.getElementById( 'waterSize' ).innerText = WIDTH + ' x ' + WIDTH;
- function change(n) {
+ function change( n ) {
+
location.hash = n;
location.reload();
return false;
- }
+ }
var options = '';
- for ( var i = 4; i < 10; i++ ) {
+ for ( var i = 4; i < 10; i ++ ) {
+
var j = Math.pow( 2, i );
options += '<a href="#" onclick="return change(' + j + ')">' + j + 'x' + j + '</a> ';
+
}
- document.getElementById('options').innerHTML = options;
+ document.getElementById( 'options' ).innerHTML = options;
init();
animate();
@@ -270,16 +267,15 @@
scene.add( sun );
var sun2 = new THREE.DirectionalLight( 0x40A040, 0.6 );
- sun2.position.set( -100, 350, -200 );
+ sun2.position.set( - 100, 350, - 200 );
scene.add( sun2 );
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
- controls = new THREE.OrbitControls( camera, renderer.domElement );
-
+ var controls = new THREE.OrbitControls( camera, renderer.domElement );
stats = new Stats();
container.appendChild( stats.dom );
@@ -288,7 +284,7 @@
document.addEventListener( 'touchstart', onDocumentTouchStart, false );
document.addEventListener( 'touchmove', onDocumentTouchMove, false );
- document.addEventListener( 'keydown', function( event ) {
+ document.addEventListener( 'keydown', function ( event ) {
// W Pressed: Toggle wireframe
if ( event.keyCode === 87 ) {
@@ -298,19 +294,18 @@
}
- } , false );
+ }, false );
window.addEventListener( 'resize', onWindowResize, false );
-
var gui = new dat.GUI();
var effectController = {
mouseSize: 20.0,
viscosity: 0.03
};
- var valuesChanger = function() {
+ var valuesChanger = function () {
heightmapVariable.material.uniforms.mouseSize.value = effectController.mouseSize;
heightmapVariable.material.uniforms.viscosityConstant.value = effectController.viscosity;
@@ -320,25 +315,25 @@
gui.add( effectController, "mouseSize", 1.0, 100.0, 1.0 ).onChange( valuesChanger );
gui.add( effectController, "viscosity", 0.0, 0.1, 0.001 ).onChange( valuesChanger );
var buttonSmooth = {
- smoothWater: function() {
- smoothWater();
- }
+ smoothWater: function () {
+
+ smoothWater();
+
+ }
};
gui.add( buttonSmooth, 'smoothWater' );
-
initWater();
valuesChanger();
}
-
function initWater() {
var materialColor = 0x0040C0;
- var geometry = new THREE.PlaneBufferGeometry( BOUNDS, BOUNDS, WIDTH - 1, WIDTH -1 );
+ var geometry = new THREE.PlaneBufferGeometry( BOUNDS, BOUNDS, WIDTH - 1, WIDTH - 1 );
// material: make a ShaderMaterial clone of MeshPhongMaterial, with customized vertex shader
var material = new THREE.ShaderMaterial( {
@@ -407,7 +402,9 @@
var error = gpuCompute.init();
if ( error !== null ) {
+
console.error( error );
+
}
// Create compute shader to smooth the water surface and velocity
@@ -419,34 +416,41 @@
var waterMaxHeight = 10;
- function noise( x, y, z ) {
+ function noise( x, y ) {
+
var multR = waterMaxHeight;
var mult = 0.025;
var r = 0;
- for ( var i = 0; i < 15; i++ ) {
+ for ( var i = 0; i < 15; i ++ ) {
+
r += multR * simplex.noise( x * mult, y * mult );
multR *= 0.53 + 0.025 * i;
mult *= 1.25;
+
}
return r;
+
}
var pixels = texture.image.data;
var p = 0;
- for ( var j = 0; j < WIDTH; j++ ) {
- for ( var i = 0; i < WIDTH; i++ ) {
+ for ( var j = 0; j < WIDTH; j ++ ) {
+
+ for ( var i = 0; i < WIDTH; i ++ ) {
var x = i * 128 / WIDTH;
var y = j * 128 / WIDTH;
- pixels[ p + 0 ] = noise( x, y, 123.4 );
+ pixels[ p + 0 ] = noise( x, y );
pixels[ p + 1 ] = 0;
pixels[ p + 2 ] = 0;
pixels[ p + 3 ] = 1;
p += 4;
+
}
+
}
}
@@ -456,7 +460,7 @@
var currentRenderTarget = gpuCompute.getCurrentRenderTarget( heightmapVariable );
var alternateRenderTarget = gpuCompute.getAlternateRenderTarget( heightmapVariable );
- for ( var i = 0; i < 10; i++ ) {
+ for ( var i = 0; i < 10; i ++ ) {
smoothShader.uniforms.texture.value = currentRenderTarget.texture;
gpuCompute.doRenderTarget( smoothShader, alternateRenderTarget );
@@ -465,15 +469,11 @@
gpuCompute.doRenderTarget( smoothShader, currentRenderTarget );
}
-
- }
+ }
function onWindowResize() {
- windowHalfX = window.innerWidth / 2;
- windowHalfY = window.innerHeight / 2;
-
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@@ -502,7 +502,6 @@
setMouseCoords( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-
}
}
@@ -515,7 +514,6 @@
setMouseCoords( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-
}
}
@@ -540,18 +538,22 @@
var intersects = raycaster.intersectObject( meshRay );
if ( intersects.length > 0 ) {
+
var point = intersects[ 0 ].point;
uniforms.mousePos.value.set( point.x, point.z );
- }
- else {
+ } else {
+
uniforms.mousePos.value.set( 10000, 10000 );
+
}
mouseMoved = false;
- }
- else {
+
+ } else {
+
uniforms.mousePos.value.set( 10000, 10000 );
+
}
// Do the gpu computation | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_gpu_particle_system.html | @@ -108,7 +108,7 @@
gui.add( options, "turbulence", 0, 1 );
gui.add( spawnerOptions, "spawnRate", 10, 30000 );
- gui.add( spawnerOptions, "timeScale", -1, 1 );
+ gui.add( spawnerOptions, "timeScale", - 1, 1 );
//
@@ -161,7 +161,7 @@
options.position.y = Math.sin( tick * spawnerOptions.verticalSpeed ) * 10;
options.position.z = Math.sin( tick * spawnerOptions.horizontalSpeed + spawnerOptions.verticalSpeed ) * 5;
- for ( var x = 0; x < spawnerOptions.spawnRate * delta; x++ ) {
+ for ( var x = 0; x < spawnerOptions.spawnRate * delta; x ++ ) {
// Yep, that's really it. Spawning particles is super cheap, and once you spawn them, the rest of
// their lifecycle is handled entirely on the GPU, driven by a time uniform updated below | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_hdr.html | @@ -137,10 +137,10 @@
materialHDR = new THREE.ShaderMaterial( {
uniforms: {
- tDiffuse: { value: texture },
- exposure: { value: 0.125 },
+ tDiffuse: { value: texture },
+ exposure: { value: 0.125 },
brightMax: { value: 0.5 }
- },
+ },
vertexShader: getText( 'vs-hdr' ),
fragmentShader: getText( 'fs-hdr' )
@@ -149,7 +149,7 @@
var plane = new THREE.PlaneBufferGeometry( 512, 768 );
quad = new THREE.Mesh( plane, materialHDR );
- quad.position.z = -100;
+ quad.position.z = - 100;
scene.add( quad );
renderer = new THREE.WebGLRenderer();
@@ -208,7 +208,7 @@
if ( materialHDR.uniforms.exposure.value > 5 || materialHDR.uniforms.exposure.value <= 0 ) {
- sign *= -1;
+ sign *= - 1;
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_helpers.html | @@ -67,7 +67,7 @@
scene.add( group );
// To make sure that the matrixWorld is up to date for the boxhelpers
- group.updateMatrixWorld(true);
+ group.updateMatrixWorld( true );
group.add( mesh );
@@ -90,7 +90,7 @@
line.material.depthTest = false;
line.material.opacity = 0.25;
line.material.transparent = true;
- line.position.x = -4;
+ line.position.x = - 4;
group.add( line );
scene.add( new THREE.BoxHelper( line ) );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_buffergeometry.html | @@ -80,7 +80,7 @@
scene.add( light1 );
var light2 = new THREE.DirectionalLight( 0xffffff, 1.5 );
- light2.position.set( 0, -1, 0 );
+ light2.position.set( 0, - 1, 0 );
scene.add( light2 );
//
@@ -95,8 +95,8 @@
var color = new THREE.Color();
- var n = 800, n2 = n/2; // triangles spread in the cube
- var d = 120, d2 = d/2; // individual triangle size
+ var n = 800, n2 = n / 2; // triangles spread in the cube
+ var d = 120, d2 = d / 2; // individual triangle size
var pA = new THREE.Vector3();
var pB = new THREE.Vector3();
@@ -125,7 +125,7 @@
var cy = y + Math.random() * d - d2;
var cz = z + Math.random() * d - d2;
- positions[ i ] = ax;
+ positions[ i ] = ax;
positions[ i + 1 ] = ay;
positions[ i + 2 ] = az;
@@ -153,7 +153,7 @@
var ny = cb.y;
var nz = cb.z;
- normals[ i ] = nx;
+ normals[ i ] = nx;
normals[ i + 1 ] = ny;
normals[ i + 2 ] = nz;
@@ -173,7 +173,7 @@
color.setRGB( vx, vy, vz );
- colors[ i ] = color.r;
+ colors[ i ] = color.r;
colors[ i + 1 ] = color.g;
colors[ i + 2 ] = color.b;
@@ -194,8 +194,8 @@
geometry.computeBoundingSphere();
var material = new THREE.MeshPhongMaterial( {
- color: 0xaaaaaa, specular: 0xffffff, shininess: 250,
- side: THREE.DoubleSide, vertexColors: THREE.VertexColors
+ color: 0xaaaaaa, specular: 0xffffff, shininess: 250,
+ side: THREE.DoubleSide, vertexColors: THREE.VertexColors
} );
mesh = new THREE.Mesh( geometry, material ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_cubes.html | @@ -79,7 +79,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
- container.appendChild(renderer.domElement);
+ container.appendChild( renderer.domElement );
stats = new Stats();
container.appendChild( stats.dom ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_cubes_gpu.html | @@ -164,7 +164,7 @@
highlightBox = new THREE.Mesh(
new THREE.BoxBufferGeometry(),
new THREE.MeshLambertMaterial( { color: 0xffff00 }
- ) );
+ ) );
scene.add( highlightBox );
renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -216,11 +216,11 @@
var id = ( pixelBuffer[ 0 ] << 16 ) | ( pixelBuffer[ 1 ] << 8 ) | ( pixelBuffer[ 2 ] );
var data = pickingData[ id ];
- if ( data) {
+ if ( data ) {
//move our highlightBox so that it surrounds the picked object
- if ( data.position && data.rotation && data.scale ){
+ if ( data.position && data.rotation && data.scale ) {
highlightBox.position.copy( data.position );
highlightBox.rotation.copy( data.rotation ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_cubes_ortho.html | @@ -81,7 +81,7 @@
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
- container.appendChild(renderer.domElement);
+ container.appendChild( renderer.domElement );
stats = new Stats();
container.appendChild( stats.dom );
@@ -98,9 +98,9 @@
var aspect = window.innerWidth / window.innerHeight;
- camera.left = - frustumSize * aspect / 2;
- camera.right = frustumSize * aspect / 2;
- camera.top = frustumSize / 2;
+ camera.left = - frustumSize * aspect / 2;
+ camera.right = frustumSize * aspect / 2;
+ camera.top = frustumSize / 2;
camera.bottom = - frustumSize / 2;
camera.updateProjectionMatrix(); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_draggablecubes.html | @@ -102,8 +102,16 @@
container.appendChild( renderer.domElement );
var dragControls = new THREE.DragControls( objects, camera, renderer.domElement );
- dragControls.addEventListener( 'dragstart', function ( event ) { controls.enabled = false; } );
- dragControls.addEventListener( 'dragend', function ( event ) { controls.enabled = true; } );
+ dragControls.addEventListener( 'dragstart', function () {
+
+ controls.enabled = false;
+
+ } );
+ dragControls.addEventListener( 'dragend', function () {
+
+ controls.enabled = true;
+
+ } );
var info = document.createElement( 'div' );
info.style.position = 'absolute'; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_instances_gpu.html | @@ -377,7 +377,7 @@
instanceCount = parseInt( instanceCountElm.value );
- instanceCountElm.addEventListener( "change", function() {
+ instanceCountElm.addEventListener( "change", function () {
instanceCount = parseInt( instanceCountElm.value );
initMesh();
@@ -390,7 +390,7 @@
method = methodElm.value;
- methodElm.addEventListener( "change", function() {
+ methodElm.addEventListener( "change", function () {
method = methodElm.value;
initMesh();
@@ -403,7 +403,7 @@
doAnimate = animateElm.checked;
- animateElm.addEventListener( "click", function() {
+ animateElm.addEventListener( "click", function () {
doAnimate = animateElm.checked;
animate();
@@ -416,7 +416,7 @@
useOverrideMaterial = overrideElm.checked;
- overrideElm.addEventListener( "click", function() {
+ overrideElm.addEventListener( "click", function () {
useOverrideMaterial = overrideElm.checked;
initMesh();
@@ -427,7 +427,7 @@
var constructElm = document.getElementById( 'construct' );
- constructElm.addEventListener( "click", function() {
+ constructElm.addEventListener( "click", function () {
initMesh();
@@ -439,13 +439,13 @@
THREE.Cache.clear();
- materialList.forEach( function( m ) {
+ materialList.forEach( function ( m ) {
m.dispose();
} );
- geometryList.forEach( function( g ) {
+ geometryList.forEach( function ( g ) {
g.dispose();
@@ -468,14 +468,14 @@
}
- var randomizeMatrix = function() {
+ var randomizeMatrix = function () {
var position = new THREE.Vector3();
var rotation = new THREE.Euler();
var quaternion = new THREE.Quaternion();
var scale = new THREE.Vector3();
- return function( matrix ) {
+ return function ( matrix ) {
position.x = Math.random() * 40 - 20;
position.y = Math.random() * 40 - 20;
@@ -509,7 +509,7 @@
var start = window.performance.now();
- switch ( method ){
+ switch ( method ) {
case "merged":
makeMerged( geo );
@@ -643,35 +643,41 @@
var matrix = new THREE.Matrix4();
- function onBeforeRender( renderer, scene, camera, geometry, material, group ){
+ function onBeforeRender( renderer, scene, camera, geometry, material ) {
var updateList = [];
var u = material.uniforms;
var d = this.userData;
- if( u.pickingColor ){
+ if ( u.pickingColor ) {
+
u.pickingColor.value.setHex( d.pickingColor );
updateList.push( "pickingColor" );
+
}
- if( u.color ){
+ if ( u.color ) {
+
u.color.value.setHex( d.color );
updateList.push( "color" );
+
}
- if( updateList.length ){
+ if ( updateList.length ) {
var materialProperties = renderer.properties.get( material );
- if( materialProperties.program ){
+ if ( materialProperties.program ) {
var gl = renderer.getContext();
var p = materialProperties.program;
gl.useProgram( p.program );
var pu = p.getUniforms();
- updateList.forEach( function( name ){
+ updateList.forEach( function ( name ) {
+
pu.setValue( gl, name, u[ name ].value );
+
} );
}
@@ -703,7 +709,7 @@
object.userData[ "pickingColor" ] = i + 1;
object.onBeforeRender = onBeforeRender;
- }else {
+ } else {
pickingObject.material = pickingMaterial;
pickingObject.userData[ "pickingColor" ] = i + 1;
@@ -780,7 +786,7 @@
var colors = new THREE.BufferAttribute(
new Float32Array( instanceCount * colCount * 3 ), 3
);
- var randCol = function() {
+ var randCol = function () {
return Math.random();
@@ -887,7 +893,7 @@
igeo.addAttribute( 'mcol2', mcol2 );
igeo.addAttribute( 'mcol3', mcol3 );
- var randCol = function() {
+ var randCol = function () {
return Math.random();
@@ -1008,7 +1014,7 @@
}
- function onWindowResize( event ) {
+ function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@@ -1045,7 +1051,7 @@
renderer.render( scene, camera, pickingRenderTarget );
scene.overrideMaterial = null;
- }else {
+ } else {
renderer.render( pickingScene, camera, pickingRenderTarget );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_lines.html | @@ -27,8 +27,6 @@
var mouse = new THREE.Vector2();
var radius = 100, theta = 0;
- var currentIntersected;
-
init();
animate();
@@ -128,7 +126,7 @@
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
- container.appendChild(renderer.domElement);
+ container.appendChild( renderer.domElement );
stats = new Stats();
container.appendChild( stats.dom );
@@ -185,19 +183,15 @@
raycaster.setFromCamera( mouse, camera );
- var intersects = raycaster.intersectObjects( parentTransform.children, true);
+ var intersects = raycaster.intersectObjects( parentTransform.children, true );
if ( intersects.length > 0 ) {
- currentIntersected = intersects[ 0 ].object;
-
sphereInter.visible = true;
sphereInter.position.copy( intersects[ 0 ].point );
} else {
- currentIntersected = undefined;
-
sphereInter.visible = false;
} | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_points.html | @@ -87,7 +87,7 @@
var renderer, scene, camera, stats;
- var particles, uniforms;
+ var particles;
var PARTICLE_SIZE = 20;
@@ -139,7 +139,7 @@
var material = new THREE.ShaderMaterial( {
uniforms: {
- color: { value: new THREE.Color( 0xffffff ) },
+ color: { value: new THREE.Color( 0xffffff ) },
texture: { value: new THREE.TextureLoader().load( "textures/sprites/disc.png" ) }
},
vertexShader: document.getElementById( 'vertexshader' ).textContent, | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_raycasting_points.html | @@ -62,19 +62,19 @@
init();
animate();
- function generatePointCloudGeometry( color, width, length ){
+ function generatePointCloudGeometry( color, width, length ) {
var geometry = new THREE.BufferGeometry();
- var numPoints = width*length;
+ var numPoints = width * length;
- var positions = new Float32Array( numPoints*3 );
- var colors = new Float32Array( numPoints*3 );
+ var positions = new Float32Array( numPoints * 3 );
+ var colors = new Float32Array( numPoints * 3 );
var k = 0;
- for( var i = 0; i < width; i++ ) {
+ for ( var i = 0; i < width; i ++ ) {
- for( var j = 0; j < length; j++ ) {
+ for ( var j = 0; j < length; j ++ ) {
var u = i / width;
var v = j / length;
@@ -91,7 +91,7 @@
colors[ 3 * k + 1 ] = color.g * intensity;
colors[ 3 * k + 2 ] = color.b * intensity;
- k++;
+ k ++;
}
@@ -124,12 +124,12 @@
var k = 0;
- for( var i = 0; i < width; i++ ) {
+ for ( var i = 0; i < width; i ++ ) {
- for( var j = 0; j < length; j++ ) {
+ for ( var j = 0; j < length; j ++ ) {
indices[ k ] = k;
- k++;
+ k ++;
}
@@ -144,20 +144,20 @@
}
- function generateIndexedWithOffsetPointcloud( color, width, length ){
+ function generateIndexedWithOffsetPointcloud( color, width, length ) {
var geometry = generatePointCloudGeometry( color, width, length );
var numPoints = width * length;
var indices = new Uint16Array( numPoints );
var k = 0;
- for( var i = 0; i < width; i++ ){
+ for ( var i = 0; i < width; i ++ ) {
- for( var j = 0; j < length; j++ ) {
+ for ( var j = 0; j < length; j ++ ) {
indices[ k ] = k;
- k++;
+ k ++;
}
@@ -181,22 +181,22 @@
var k = 0;
- for( var i = 0; i < width; i++ ) {
+ for ( var i = 0; i < width; i ++ ) {
- for( var j = 0; j < length; j++ ) {
+ for ( var j = 0; j < length; j ++ ) {
var u = i / width;
var v = j / length;
var x = u - 0.5;
- var y = ( Math.cos( u * Math.PI * 8 ) + Math.sin( v * Math.PI * 8) ) / 20;
+ var y = ( Math.cos( u * Math.PI * 8 ) + Math.sin( v * Math.PI * 8 ) ) / 20;
var z = v - 0.5;
- var v = new THREE.Vector3( x,y,z );
+ var v = new THREE.Vector3( x, y, z );
geometry.vertices.push( v );
var intensity = ( y + 0.1 ) * 7;
colors[ k ] = ( color.clone().multiplyScalar( intensity ) );
- k++;
+ k ++;
}
@@ -227,24 +227,24 @@
//
- var pcBuffer = generatePointcloud( new THREE.Color( 1,0,0 ), width, length );
- pcBuffer.scale.set( 10,10,10 );
- pcBuffer.position.set( -5,0,5 );
+ var pcBuffer = generatePointcloud( new THREE.Color( 1, 0, 0 ), width, length );
+ pcBuffer.scale.set( 10, 10, 10 );
+ pcBuffer.position.set( - 5, 0, 5 );
scene.add( pcBuffer );
- var pcIndexed = generateIndexedPointcloud( new THREE.Color( 0,1,0 ), width, length );
- pcIndexed.scale.set( 10,10,10 );
- pcIndexed.position.set( 5,0,5 );
+ var pcIndexed = generateIndexedPointcloud( new THREE.Color( 0, 1, 0 ), width, length );
+ pcIndexed.scale.set( 10, 10, 10 );
+ pcIndexed.position.set( 5, 0, 5 );
scene.add( pcIndexed );
- var pcIndexedOffset = generateIndexedWithOffsetPointcloud( new THREE.Color( 0,1,1 ), width, length );
- pcIndexedOffset.scale.set( 10,10,10 );
- pcIndexedOffset.position.set( 5,0,-5 );
+ var pcIndexedOffset = generateIndexedWithOffsetPointcloud( new THREE.Color( 0, 1, 1 ), width, length );
+ pcIndexedOffset.scale.set( 10, 10, 10 );
+ pcIndexedOffset.position.set( 5, 0, - 5 );
scene.add( pcIndexedOffset );
- var pcRegular = generateRegularPointcloud( new THREE.Color( 1,0,1 ), width, length );
- pcRegular.scale.set( 10,10,10 );
- pcRegular.position.set( -5,0,-5 );
+ var pcRegular = generateRegularPointcloud( new THREE.Color( 1, 0, 1 ), width, length );
+ pcRegular.scale.set( 10, 10, 10 );
+ pcRegular.position.set( - 5, 0, - 5 );
scene.add( pcRegular );
pointclouds = [ pcBuffer, pcIndexed, pcIndexedOffset, pcRegular ];
@@ -254,7 +254,7 @@
var sphereGeometry = new THREE.SphereBufferGeometry( 0.1, 32, 32 );
var sphereMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
- for ( var i = 0; i < 40; i++ ) {
+ for ( var i = 0; i < 40; i ++ ) {
var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
scene.add( sphere );
@@ -325,7 +325,7 @@
var intersections = raycaster.intersectObjects( pointclouds );
intersection = ( intersections.length ) > 0 ? intersections[ 0 ] : null;
- if ( toggle > 0.02 && intersection !== null) {
+ if ( toggle > 0.02 && intersection !== null ) {
spheres[ spheresIndex ].position.copy( intersection.point );
spheres[ spheresIndex ].scale.set( 1, 1, 1 );
@@ -335,7 +335,7 @@
}
- for ( var i = 0; i < spheres.length; i++ ) {
+ for ( var i = 0; i < spheres.length; i ++ ) {
var sphere = spheres[ i ];
sphere.scale.multiplyScalar( 0.98 ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_interactive_voxelpainter.html | @@ -181,7 +181,7 @@
}
- // create cube
+ // create cube
} else {
@@ -202,7 +202,7 @@
function onDocumentKeyDown( event ) {
- switch( event.keyCode ) {
+ switch ( event.keyCode ) {
case 16: isShiftDown = true; break;
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_kinect.html | @@ -25,9 +25,7 @@
}
a {
-
color: #0040ff;
-
}
</style>
</head>
@@ -98,8 +96,8 @@
var container;
- var scene, camera, light, renderer;
- var geometry, cube, mesh, material;
+ var scene, camera, renderer;
+ var geometry, mesh, material;
var mouse, center;
var stats;
@@ -137,7 +135,7 @@
center.z = - 1000;
video = document.createElement( 'video' );
- video.addEventListener( 'loadedmetadata', function ( event ) {
+ video.addEventListener( 'loadedmetadata', function () {
texture = new THREE.VideoTexture( video );
texture.minFilter = THREE.NearestFilter;
@@ -163,14 +161,14 @@
uniforms: {
- "map": { value: texture },
- "width": { value: width },
- "height": { value: height },
+ "map": { value: texture },
+ "width": { value: width },
+ "height": { value: height },
"nearClipping": { value: nearClipping },
- "farClipping": { value: farClipping },
+ "farClipping": { value: farClipping },
- "pointSize": { value: 2 },
- "zOffset": { value: 1000 }
+ "pointSize": { value: 2 },
+ "zOffset": { value: 1000 }
},
vertexShader: document.getElementById( 'vs' ).textContent, | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_layers.html | @@ -17,7 +17,7 @@
top: 10px;
width: 100%;
text-align: center;
- z-index: 0; // to not conflict with dat.gui
+ z-index: 0; /* to not conflict with dat.gui */
display:block;
}
</style>
@@ -92,12 +92,10 @@
}
- raycaster = new THREE.Raycaster();
-
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
- container.appendChild(renderer.domElement);
+ container.appendChild( renderer.domElement );
stats = new Stats();
container.appendChild( stats.dom );
@@ -107,9 +105,21 @@
//
// Init gui
var gui = new dat.GUI();
- gui.add( layers, 'red' ).onChange( function () { camera.layers.toggle( 0 ); } );
- gui.add( layers, 'green' ).onChange( function () { camera.layers.toggle( 1 ); } );
- gui.add( layers, 'blue' ).onChange( function () { camera.layers.toggle( 2 ); } );
+ gui.add( layers, 'red' ).onChange( function () {
+
+ camera.layers.toggle( 0 );
+
+ } );
+ gui.add( layers, 'green' ).onChange( function () {
+
+ camera.layers.toggle( 1 );
+
+ } );
+ gui.add( layers, 'blue' ).onChange( function () {
+
+ camera.layers.toggle( 2 );
+
+ } );
window.addEventListener( 'resize', onWindowResize, false );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lensflares.html | @@ -113,7 +113,7 @@
// lights
var dirLight = new THREE.DirectionalLight( 0xffffff, 0.05 );
- dirLight.position.set( 0, -1, 0 ).normalize();
+ dirLight.position.set( 0, - 1, 0 ).normalize();
dirLight.color.setHSL( 0.1, 0.7, 0.5 );
scene.add( dirLight );
@@ -124,7 +124,7 @@
var textureFlare3 = textureLoader.load( 'textures/lensflare/lensflare3.png' );
addLight( 0.55, 0.9, 0.5, 5000, 0, - 1000 );
- addLight( 0.08, 0.8, 0.5, 0, 0, - 1000 );
+ addLight( 0.08, 0.8, 0.5, 0, 0, - 1000 );
addLight( 0.995, 0.5, 0.9, 5000, 5000, - 1000 );
function addLight( h, s, l, x, y, z ) {
@@ -169,7 +169,7 @@
//
- function onWindowResize( event ) {
+ function onWindowResize() {
renderer.setSize( window.innerWidth, window.innerHeight );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lights_hemisphere.html | @@ -127,7 +127,7 @@
dirLight = new THREE.DirectionalLight( 0xffffff, 1 );
dirLight.color.setHSL( 0.1, 1, 0.95 );
- dirLight.position.set( -1, 1.75, 1 );
+ dirLight.position.set( - 1, 1.75, 1 );
dirLight.position.multiplyScalar( 30 );
scene.add( dirLight );
@@ -138,13 +138,13 @@
var d = 50;
- dirLight.shadow.camera.left = -d;
+ dirLight.shadow.camera.left = - d;
dirLight.shadow.camera.right = d;
dirLight.shadow.camera.top = d;
- dirLight.shadow.camera.bottom = -d;
+ dirLight.shadow.camera.bottom = - d;
dirLight.shadow.camera.far = 3500;
- dirLight.shadow.bias = -0.0001;
+ dirLight.shadow.bias = - 0.0001;
dirLightHeper = new THREE.DirectionalLightHelper( dirLight, 10 );
scene.add( dirLightHeper );
@@ -156,8 +156,8 @@
groundMat.color.setHSL( 0.095, 1, 0.75 );
var ground = new THREE.Mesh( groundGeo, groundMat );
- ground.rotation.x = -Math.PI/2;
- ground.position.y = -33;
+ ground.rotation.x = - Math.PI / 2;
+ ground.position.y = - 33;
scene.add( ground );
ground.receiveShadow = true;
@@ -167,10 +167,10 @@
var vertexShader = document.getElementById( 'vertexShader' ).textContent;
var fragmentShader = document.getElementById( 'fragmentShader' ).textContent;
var uniforms = {
- topColor: { value: new THREE.Color( 0x0077ff ) },
+ topColor: { value: new THREE.Color( 0x0077ff ) },
bottomColor: { value: new THREE.Color( 0xffffff ) },
- offset: { value: 33 },
- exponent: { value: 0.6 }
+ offset: { value: 33 },
+ exponent: { value: 0.6 }
};
uniforms.topColor.value.copy( hemiLight.color );
@@ -186,14 +186,14 @@
var loader = new THREE.GLTFLoader();
- loader.load( 'models/gltf/Flamingo.glb', function( gltf ) {
+ loader.load( 'models/gltf/Flamingo.glb', function ( gltf ) {
var mesh = gltf.scene.children[ 0 ];
var s = 0.35;
mesh.scale.set( s, s, s );
mesh.position.y = 15;
- mesh.rotation.y = -1;
+ mesh.rotation.y = - 1;
mesh.castShadow = true;
mesh.receiveShadow = true;
@@ -239,21 +239,21 @@
}
- function onKeyDown ( event ) {
+ function onKeyDown( event ) {
switch ( event.keyCode ) {
case 72: // h
- hemiLight.visible = !hemiLight.visible;
- hemiLightHelper.visible = !hemiLightHelper.visible;
- break;
+ hemiLight.visible = ! hemiLight.visible;
+ hemiLightHelper.visible = ! hemiLightHelper.visible;
+ break;
case 68: // d
- dirLight.visible = !dirLight.visible;
- dirLightHeper.visible = !dirLightHeper.visible;
- break;
+ dirLight.visible = ! dirLight.visible;
+ dirLightHeper.visible = ! dirLightHeper.visible;
+ break;
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lights_physical.html | @@ -55,8 +55,7 @@
}
var camera, scene, renderer,
- bulbLight, bulbMat, hemiLight,
- object, loader, stats;
+ bulbLight, bulbMat, hemiLight, stats;
var ballMat, cubeMat, floorMat;
@@ -91,12 +90,9 @@
shadows: true,
exposure: 0.68,
bulbPower: Object.keys( bulbLuminousPowers )[ 4 ],
- hemiIrradiance: Object.keys( hemiLuminousIrradiances )[0]
+ hemiIrradiance: Object.keys( hemiLuminousIrradiances )[ 0 ]
};
-
- var clock = new THREE.Clock();
-
init();
animate();
@@ -109,7 +105,7 @@
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 100 );
- camera.position.x = -4;
+ camera.position.x = - 4;
camera.position.z = 4;
camera.position.y = 2;
@@ -122,7 +118,7 @@
emissive: 0xffffee,
emissiveIntensity: 1,
color: 0x000000
- });
+ } );
bulbLight.add( new THREE.Mesh( bulbGeometry, bulbMat ) );
bulbLight.position.set( 0, 2, 0 );
bulbLight.castShadow = true;
@@ -136,76 +132,90 @@
color: 0xffffff,
metalness: 0.2,
bumpScale: 0.0005
- });
+ } );
var textureLoader = new THREE.TextureLoader();
- textureLoader.load( "textures/hardwood2_diffuse.jpg", function( map ) {
+ textureLoader.load( "textures/hardwood2_diffuse.jpg", function ( map ) {
+
map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 4;
map.repeat.set( 10, 24 );
floorMat.map = map;
floorMat.needsUpdate = true;
- } );
- textureLoader.load( "textures/hardwood2_bump.jpg", function( map ) {
+
+ } );
+ textureLoader.load( "textures/hardwood2_bump.jpg", function ( map ) {
+
map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 4;
map.repeat.set( 10, 24 );
floorMat.bumpMap = map;
floorMat.needsUpdate = true;
- } );
- textureLoader.load( "textures/hardwood2_roughness.jpg", function( map ) {
+
+ } );
+ textureLoader.load( "textures/hardwood2_roughness.jpg", function ( map ) {
+
map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 4;
map.repeat.set( 10, 24 );
floorMat.roughnessMap = map;
floorMat.needsUpdate = true;
- } );
+
+ } );
cubeMat = new THREE.MeshStandardMaterial( {
roughness: 0.7,
color: 0xffffff,
bumpScale: 0.002,
metalness: 0.2
- });
- textureLoader.load( "textures/brick_diffuse.jpg", function( map ) {
+ } );
+ textureLoader.load( "textures/brick_diffuse.jpg", function ( map ) {
+
map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 4;
map.repeat.set( 1, 1 );
cubeMat.map = map;
cubeMat.needsUpdate = true;
- } );
- textureLoader.load( "textures/brick_bump.jpg", function( map ) {
+
+ } );
+ textureLoader.load( "textures/brick_bump.jpg", function ( map ) {
+
map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 4;
map.repeat.set( 1, 1 );
cubeMat.bumpMap = map;
cubeMat.needsUpdate = true;
- } );
+
+ } );
ballMat = new THREE.MeshStandardMaterial( {
color: 0xffffff,
roughness: 0.5,
metalness: 1.0
- });
- textureLoader.load( "textures/planets/earth_atmos_2048.jpg", function( map ) {
+ } );
+ textureLoader.load( "textures/planets/earth_atmos_2048.jpg", function ( map ) {
+
map.anisotropy = 4;
ballMat.map = map;
ballMat.needsUpdate = true;
- } );
- textureLoader.load( "textures/planets/earth_specular_2048.jpg", function( map ) {
+
+ } );
+ textureLoader.load( "textures/planets/earth_specular_2048.jpg", function ( map ) {
+
map.anisotropy = 4;
ballMat.metalnessMap = map;
ballMat.needsUpdate = true;
- } );
+
+ } );
var floorGeometry = new THREE.PlaneBufferGeometry( 20, 20 );
var floorMesh = new THREE.Mesh( floorGeometry, floorMat );
floorMesh.receiveShadow = true;
- floorMesh.rotation.x = -Math.PI / 2.0;
+ floorMesh.rotation.x = - Math.PI / 2.0;
scene.add( floorMesh );
var ballGeometry = new THREE.SphereBufferGeometry( 0.5, 32, 32 );
@@ -217,12 +227,12 @@
var boxGeometry = new THREE.BoxBufferGeometry( 0.5, 0.5, 0.5 );
var boxMesh = new THREE.Mesh( boxGeometry, cubeMat );
- boxMesh.position.set( -0.5, 0.25, -1 );
+ boxMesh.position.set( - 0.5, 0.25, - 1 );
boxMesh.castShadow = true;
scene.add( boxMesh );
var boxMesh2 = new THREE.Mesh( boxGeometry, cubeMat );
- boxMesh2.position.set( 0, 0.25, -5 );
+ boxMesh2.position.set( 0, 0.25, - 5 );
boxMesh2.castShadow = true;
scene.add( boxMesh2 );
@@ -255,7 +265,8 @@
gui.add( params, 'exposure', 0, 1 );
gui.add( params, 'shadows' );
gui.open();
- }
+
+}
function onWindowResize() {
@@ -283,12 +294,14 @@
renderer.toneMappingExposure = Math.pow( params.exposure, 5.0 ); // to allow for very bright scenes.
renderer.shadowMap.enabled = params.shadows;
bulbLight.castShadow = params.shadows;
- if( params.shadows !== previousShadowMap ) {
+ if ( params.shadows !== previousShadowMap ) {
+
ballMat.needsUpdate = true;
cubeMat.needsUpdate = true;
floorMat.needsUpdate = true;
previousShadowMap = params.shadows;
- }
+
+ }
bulbLight.power = bulbLuminousPowers[ params.bulbPower ];
bulbMat.emissiveIntensity = bulbLight.intensity / Math.pow( 0.02, 2.0 ); // convert from intensity to irradiance at bulb surface
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lights_pointlights.html | @@ -48,8 +48,8 @@
}
var camera, scene, renderer,
- light1, light2, light3, light4,
- object, stats;
+ light1, light2, light3, light4,
+ object, stats;
var clock = new THREE.Clock();
@@ -134,7 +134,7 @@
var time = Date.now() * 0.0005;
var delta = clock.getDelta();
- if( object ) object.rotation.y -= 0.5 * delta;
+ if ( object ) object.rotation.y -= 0.5 * delta;
light1.position.x = Math.sin( time * 0.7 ) * 30;
light1.position.y = Math.cos( time * 0.5 ) * 40; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lights_rectarealight.html | @@ -33,7 +33,6 @@
</head>
<body>
- <div id="container"></div>
<div id="info">
<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - Demo of RectAreaLight - by <a href="http://github.com/abelnation" target="_blank" rel="noopener">abelnation</a><br />
Click and drag to move OrbitControls.<br />
@@ -49,8 +48,6 @@
<script>
- var container = document.getElementById( 'container' );
-
if ( WEBGL.isWebGLAvailable() === false ) {
document.body.appendChild( WEBGL.getWebGLErrorMessage() );
@@ -92,7 +89,7 @@
}
- if ( ! gl.getExtension('OES_texture_float_linear' ) ) {
+ if ( ! gl.getExtension( 'OES_texture_float_linear' ) ) {
alert( 'OES_texture_float_linear not supported' );
throw 'missing webgl extension'; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lights_spotlight.html | @@ -162,7 +162,7 @@
angle: spotLight.angle,
penumbra: spotLight.penumbra,
decay: spotLight.decay
- }
+ };
gui.addColor( params, 'light color' ).onChange( function ( val ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lights_spotlights.html | @@ -154,14 +154,14 @@
angle: ( Math.random() * 0.7 ) + 0.1,
penumbra: Math.random() + 1
}, Math.random() * 3000 + 2000 )
- .easing( TWEEN.Easing.Quadratic.Out ).start();
+ .easing( TWEEN.Easing.Quadratic.Out ).start();
new TWEEN.Tween( light.position ).to( {
x: ( Math.random() * 30 ) - 15,
y: ( Math.random() * 10 ) + 15,
z: ( Math.random() * 30 ) - 15
}, Math.random() * 3000 + 2000 )
- .easing( TWEEN.Easing.Quadratic.Out ).start();
+ .easing( TWEEN.Easing.Quadratic.Out ).start();
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lines_colors.html | @@ -11,10 +11,6 @@
overflow: hidden;
}
- a {
- color:#0078ff;
- }
-
#info {
position: absolute;
top: 10px; width: 100%;
@@ -82,7 +78,7 @@
//
- var hilbertPoints = hilbert3D( new THREE.Vector3( 0,0,0 ), 200.0, 1, 0, 1, 2, 3, 4, 5, 6, 7 );
+ var hilbertPoints = hilbert3D( new THREE.Vector3( 0, 0, 0 ), 200.0, 1, 0, 1, 2, 3, 4, 5, 6, 7 );
var geometry1 = new THREE.BufferGeometry();
var geometry2 = new THREE.BufferGeometry();
@@ -100,7 +96,7 @@
var spline = new THREE.CatmullRomCurve3( hilbertPoints );
- for ( var i = 0; i < hilbertPoints.length * subdivisions; i++ ) {
+ for ( var i = 0; i < hilbertPoints.length * subdivisions; i ++ ) {
var t = i / ( hilbertPoints.length * subdivisions );
spline.getPoint( t, point );
@@ -137,7 +133,7 @@
colors2 = [];
colors3 = [];
- for ( var i = 0; i < hilbertPoints.length; i++ ) {
+ for ( var i = 0; i < hilbertPoints.length; i ++ ) {
var point = hilbertPoints[ i ];
@@ -168,21 +164,21 @@
var line, p, scale = 0.3, d = 225;
- var parameters = [
+ var parameters = [
[ material, scale * 1.5, [ - d, - d / 2, 0 ], geometry1 ],
- [ material, scale * 1.5, [ 0, - d / 2, 0 ], geometry2 ],
- [ material, scale * 1.5, [ d, - d / 2, 0 ], geometry3 ],
+ [ material, scale * 1.5, [ 0, - d / 2, 0 ], geometry2 ],
+ [ material, scale * 1.5, [ d, - d / 2, 0 ], geometry3 ],
[ material, scale * 1.5, [ - d, d / 2, 0 ], geometry4 ],
- [ material, scale * 1.5, [ 0, d / 2, 0 ], geometry5 ],
- [ material, scale * 1.5, [ d, d / 2, 0 ], geometry6 ],
+ [ material, scale * 1.5, [ 0, d / 2, 0 ], geometry5 ],
+ [ material, scale * 1.5, [ d, d / 2, 0 ], geometry6 ],
];
- for ( var i = 0; i < parameters.length; i++ ) {
+ for ( var i = 0; i < parameters.length; i ++ ) {
p = parameters[ i ];
- line = new THREE.Line( p[ 3 ], p[ 0 ] );
- line.scale.x = line.scale.y = line.scale.z = p[ 1 ];
+ line = new THREE.Line( p[ 3 ], p[ 0 ] );
+ line.scale.x = line.scale.y = line.scale.z = p[ 1 ];
line.position.x = p[ 2 ][ 0 ];
line.position.y = p[ 2 ][ 1 ];
line.position.z = p[ 2 ][ 2 ];
@@ -220,6 +216,7 @@
mouseX = event.clientX - windowHalfX;
mouseY = event.clientY - windowHalfY;
+
}
function onDocumentTouchStart( event ) {
@@ -230,7 +227,9 @@
mouseX = event.touches[ 0 ].pageX - windowHalfX;
mouseY = event.touches[ 0 ].pageY - windowHalfY;
+
}
+
}
function onDocumentTouchMove( event ) {
@@ -241,6 +240,7 @@
mouseX = event.touches[ 0 ].pageX - windowHalfX;
mouseY = event.touches[ 0 ].pageY - windowHalfY;
+
}
}
@@ -269,7 +269,7 @@
if ( object.isLine ) {
- object.rotation.y = time * ( i % 2 ? 1 : -1 );
+ object.rotation.y = time * ( i % 2 ? 1 : - 1 );
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lines_dashed.html | @@ -110,41 +110,41 @@
var position = [];
position.push(
- -h, -h, -h,
- -h, h, -h,
+ - h, - h, - h,
+ - h, h, - h,
- -h, h, -h,
- h, h, -h,
+ - h, h, - h,
+ h, h, - h,
- h, h, -h,
- h, -h, -h,
+ h, h, - h,
+ h, - h, - h,
- h, -h, -h,
- -h, -h, -h,
+ h, - h, - h,
+ - h, - h, - h,
- -h, -h, h,
- -h, h, h,
+ - h, - h, h,
+ - h, h, h,
- -h, h, h,
+ - h, h, h,
h, h, h,
h, h, h,
- h, -h, h,
+ h, - h, h,
- h, -h, h,
- -h, -h, h,
+ h, - h, h,
+ - h, - h, h,
- -h, -h, -h,
- -h, -h, h,
+ - h, - h, - h,
+ - h, - h, h,
- -h, h, -h,
- -h, h, h,
+ - h, h, - h,
+ - h, h, h,
- h, h, -h,
+ h, h, - h,
h, h, h,
- h, -h, -h,
- h, -h, h
+ h, - h, - h,
+ h, - h, h
);
geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
@@ -175,7 +175,7 @@
var time = Date.now() * 0.001;
- scene.traverse( function( object ) {
+ scene.traverse( function ( object ) {
if ( object.isLine ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_lines_sphere.html | @@ -11,10 +11,6 @@
overflow: hidden;
}
- a {
- color:#0078ff;
- }
-
#info {
position: absolute;
top: 10px; width: 100%;
@@ -59,14 +55,13 @@
var SCREEN_WIDTH = window.innerWidth,
SCREEN_HEIGHT = window.innerHeight,
- r = 450,
+ r = 450,
- mouseX = 0, mouseY = 0,
+ mouseY = 0,
- windowHalfX = window.innerWidth / 2,
- windowHalfY = window.innerHeight / 2,
+ windowHalfY = window.innerHeight / 2,
- camera, scene, renderer;
+ camera, scene, renderer;
init();
animate();
@@ -79,12 +74,12 @@
scene = new THREE.Scene();
var i, line, material, p,
- parameters = [ [ 0.25, 0xff7700, 1 ], [ 0.5, 0xff9900, 1 ], [ 0.75, 0xffaa00, 0.75 ], [ 1, 0xffaa00, 0.5 ], [ 1.25, 0x000833, 0.8 ],
- [ 3.0, 0xaaaaaa, 0.75 ], [ 3.5, 0xffffff, 0.5 ], [ 4.5, 0xffffff, 0.25 ], [ 5.5, 0xffffff, 0.125 ] ];
+ parameters = [[ 0.25, 0xff7700, 1 ], [ 0.5, 0xff9900, 1 ], [ 0.75, 0xffaa00, 0.75 ], [ 1, 0xffaa00, 0.5 ], [ 1.25, 0x000833, 0.8 ],
+ [ 3.0, 0xaaaaaa, 0.75 ], [ 3.5, 0xffffff, 0.5 ], [ 4.5, 0xffffff, 0.25 ], [ 5.5, 0xffffff, 0.125 ]];
var geometry = createGeometry();
- for( i = 0; i < parameters.length; ++ i ) {
+ for ( i = 0; i < parameters.length; ++ i ) {
p = parameters[ i ];
@@ -164,7 +159,6 @@
function onWindowResize() {
- windowHalfX = window.innerWidth / 2;
windowHalfY = window.innerHeight / 2;
camera.aspect = window.innerWidth / window.innerHeight;
@@ -176,7 +170,6 @@
function onDocumentMouseMove( event ) {
- mouseX = event.clientX - windowHalfX;
mouseY = event.clientY - windowHalfY;
}
@@ -187,7 +180,6 @@
event.preventDefault();
- mouseX = event.touches[ 0 ].pageX - windowHalfX;
mouseY = event.touches[ 0 ].pageY - windowHalfY;
}
@@ -200,7 +192,6 @@
event.preventDefault();
- mouseX = event.touches[ 0 ].pageX - windowHalfX;
mouseY = event.touches[ 0 ].pageY - windowHalfY;
} | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_3ds.html | @@ -72,13 +72,14 @@
if ( child instanceof THREE.Mesh ) {
child.material.normalMap = normal;
+
}
} );
scene.add( object );
- });
+ } );
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_3mf.html | @@ -30,7 +30,6 @@
span {
display: inline-block;
width: 60px;
- float: left;
text-align: center;
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_amf.html | @@ -30,7 +30,6 @@
span {
display: inline-block;
width: 60px;
- float: left;
text-align: center;
}
@@ -76,14 +75,14 @@
// Z is up for objects intended to be 3D printed.
camera.up.set( 0, 0, 1 );
- camera.position.set( 0, -9, 6 );
+ camera.position.set( 0, - 9, 6 );
camera.add( new THREE.PointLight( 0xffffff, 0.8 ) );
scene.add( camera );
var grid = new THREE.GridHelper( 50, 50, 0xffffff, 0x555555 );
- grid.rotateOnAxis( new THREE.Vector3( 1, 0, 0 ), 90 * ( Math.PI/180 ) );
+ grid.rotateOnAxis( new THREE.Vector3( 1, 0, 0 ), 90 * ( Math.PI / 180 ) );
scene.add( grid );
renderer = new THREE.WebGLRenderer( { antialias: true } ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_assimp.html | @@ -33,7 +33,6 @@
span {
display: inline-block;
width: 60px;
- float: left;
text-align: center;
}
</style> | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_assimp2json.html | @@ -155,6 +155,7 @@
render();
stats.update();
+
}
// | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_awd.html | @@ -50,8 +50,8 @@
var container, stats;
- var camera, scene, renderer, objects, controls;
- var particleLight, pointLight;
+ var camera, scene, renderer;
+ var pointLight;
var trunk;
var loader = new THREE.AWDLoader();
@@ -66,8 +66,8 @@
} );
+ function createMaterial() {
- function createMaterial( name ){
// console.log( name );
// var mat = new THREE.MeshPhongMaterial({
// color: 0xaaaaaa,
@@ -76,33 +76,31 @@
// });
// return mat;
return null;
- }
+ }
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
- camera.position.set( 70, 50, -100 );
+ camera.position.set( 70, 50, - 100 );
- controls = new THREE.OrbitControls( camera );
+ var controls = new THREE.OrbitControls( camera );
scene = new THREE.Scene();
-
// Add the AWD SCENE
scene.add( trunk );
-
// Lights
scene.add( new THREE.AmbientLight( 0x606060 ) );
- var directionalLight = new THREE.DirectionalLight(/*Math.random() * 0xffffff*/0xeeeeee );
- directionalLight.position.set( .2, -1, .2 );
+ var directionalLight = new THREE.DirectionalLight( /*Math.random() * 0xffffff*/0xeeeeee );
+ directionalLight.position.set( .2, - 1, .2 );
directionalLight.position.normalize();
scene.add( directionalLight );
@@ -132,8 +130,6 @@
}
-
-
function render() {
requestAnimationFrame( render ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_babylon.html | @@ -65,15 +65,12 @@
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
- console.log( Math.round(percentComplete, 2) + '% downloaded' );
+ console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
}
};
- var onError = function ( xhr ) {
- };
-
// model
var loader = new THREE.BabylonLoader( manager );
@@ -95,7 +92,7 @@
animate();
- }, onProgress, onError );
+ }, onProgress, null );
//
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_bvh.html | @@ -46,7 +46,7 @@
animate();
var loader = new THREE.BVHLoader();
- loader.load( "models/bvh/pirouette.bvh", function( result ) {
+ loader.load( "models/bvh/pirouette.bvh", function ( result ) {
skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] );
skeletonHelper.skeleton = result.skeleton; // allow animation mixer to bind to SkeletonHelper directly | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_collada.html | @@ -70,7 +70,7 @@
// loading manager
- var loadingManager = new THREE.LoadingManager( function() {
+ var loadingManager = new THREE.LoadingManager( function () {
scene.add( elf );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_collada_kinematics.html | @@ -52,7 +52,7 @@
var container, stats;
- var camera, scene, renderer, objects;
+ var camera, scene, renderer;
var particleLight;
var dae;
@@ -163,7 +163,7 @@
kinematicsTween = new TWEEN.Tween( tweenParameters ).to( target, duration ).easing( TWEEN.Easing.Quadratic.Out );
- kinematicsTween.onUpdate( function() {
+ kinematicsTween.onUpdate( function () {
for ( var prop in kinematics.joints ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_collada_skinning.html | @@ -75,7 +75,7 @@
var animations = collada.animations;
var avatar = collada.scene;
- avatar.traverse( function( node ) {
+ avatar.traverse( function ( node ) {
if ( node.isSkinnedMesh ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_ctm.html | @@ -55,8 +55,6 @@
var camera, scene, renderer;
- var mesh, zmesh, geometry;
-
var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2;
@@ -66,7 +64,7 @@
var cubeTextureLoader = new THREE.CubeTextureLoader();
var reflectionCube;
- document.addEventListener('mousemove', onDocumentMouseMove, false);
+ document.addEventListener( 'mousemove', onDocumentMouseMove, false );
init();
animate();
@@ -100,7 +98,7 @@
scene.add( ambient );
var light = new THREE.SpotLight( 0xffeedd, 1.2, 650, Math.PI / 6 );
- light.position.set( 0, -100, 500 );
+ light.position.set( 0, - 100, 500 );
light.castShadow = true;
light.shadow.mapWidth = 1024;
@@ -145,37 +143,37 @@
if ( c === 3 ) {
var e = Date.now();
- console.log( "Total parse time: " + (e-s) + " ms" );
+ console.log( "Total parse time: " + ( e - s ) + " ms" );
}
}
var loader = new THREE.CTMLoader();
- loader.load( "models/ctm/ben.ctm", function( geometry ) {
+ loader.load( "models/ctm/ben.ctm", function ( geometry ) {
var material = new THREE.MeshLambertMaterial( { color: 0xffaa00, map: textureLoader.load( "textures/UV_Grid_Sm.jpg" ), envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.3 } );
- callbackModel( geometry, 450, material, 0, -200, 0, 0, 0 );
+ callbackModel( geometry, 450, material, 0, - 200, 0, 0, 0 );
checkTime();
}, { useWorker: true } );
- loader.load( "models/ctm/WaltHead.ctm", function( geometry ) {
+ loader.load( "models/ctm/WaltHead.ctm", function ( geometry ) {
var material1 = new THREE.MeshLambertMaterial( { color: 0xffffff } );
var material2 = new THREE.MeshPhongMaterial( { color: 0xff4400, specular: 0x333333, shininess: 100 } );
var material3 = new THREE.MeshPhongMaterial( { color: 0x00ff44, specular: 0x333333, shininess: 100 } );
- callbackModel( geometry, 5, material1, -200, 0, -50, 0, 0 );
- callbackModel( geometry, 2, material2, 100, 0, 125, 0, 0 );
- callbackModel( geometry, 2, material3, -100, 0, 125, 0, 0 );
+ callbackModel( geometry, 5, material1, - 200, 0, - 50, 0, 0 );
+ callbackModel( geometry, 2, material2, 100, 0, 125, 0, 0 );
+ callbackModel( geometry, 2, material3, - 100, 0, 125, 0, 0 );
checkTime();
}, { useWorker: true } );
- loader.load( "models/ctm/LeePerry.ctm", function( geometry ) {
+ loader.load( "models/ctm/LeePerry.ctm", function ( geometry ) {
var material = new THREE.MeshPhongMaterial( {
@@ -213,7 +211,7 @@
//
- function onWindowResize( event ) {
+ function onWindowResize() {
SCREEN_WIDTH = window.innerWidth;
SCREEN_HEIGHT = window.innerHeight; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_ctm_materials.html | @@ -60,22 +60,14 @@
var SCREEN_WIDTH = window.innerWidth;
var SCREEN_HEIGHT = window.innerHeight;
- var FLOOR = -250;
var container, stats;
var camera, scene, controls;
var renderer;
- var mesh;
-
var textureCube;
- var mouseX = 0, mouseY = 0;
-
- var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
-
init();
animate();
@@ -116,7 +108,7 @@
scene.add( light );
var light = new THREE.PointLight( 0xffffff, 0.75 );
- light.position.set( -12, 4.6, 2.4 );
+ light.position.set( - 12, 4.6, 2.4 );
light.position.multiplyScalar( 30 );
scene.add( light );
@@ -144,19 +136,18 @@
// EVENTS
window.addEventListener( 'resize', onWindowResize, false );
- window.addEventListener( 'mousemove', onDocumentMouseMove, false );
// LOADER
var start = Date.now();
// new way via CTMLoader and separate parts
- var position = new THREE.Vector3( -105, -78, -30 );
+ var position = new THREE.Vector3( - 105, - 78, - 30 );
var scale = new THREE.Vector3( 30, 30, 30 );
var loader = new THREE.CTMLoader();
- loader.loadParts( "models/ctm/camaro/camaro.js", function( geometries, materials ) {
+ loader.loadParts( "models/ctm/camaro/camaro.js", function ( geometries, materials ) {
hackMaterials( materials );
@@ -185,7 +176,7 @@
var m = materials[ i ];
- if ( m.name.indexOf( "Body" ) !== -1 ) {
+ if ( m.name.indexOf( "Body" ) !== - 1 ) {
var mm = new THREE.MeshStandardMaterial();
@@ -197,7 +188,7 @@
materials[ i ] = mm;
- } else if ( m.name.indexOf( "tire_car" ) !== -1 ) {
+ } else if ( m.name.indexOf( "tire_car" ) !== - 1 ) {
var mm = new THREE.MeshStandardMaterial();
@@ -208,7 +199,7 @@
materials[ i ] = mm;
- } else if ( m.name.indexOf( "mirror" ) !== -1 ) {
+ } else if ( m.name.indexOf( "mirror" ) !== - 1 ) {
var mm = new THREE.MeshStandardMaterial();
@@ -220,12 +211,11 @@
materials[ i ] = mm;
- } else if ( m.name.indexOf( "glass" ) !== -1 ) {
+ } else if ( m.name.indexOf( "glass" ) !== - 1 ) {
var mm = new THREE.MeshStandardMaterial();
mm.color.copy( m.color );
-// mm.lightMap = m.map;
mm.envMap = textureCube;
mm.metalness = 1;
mm.roughtness = 0.1;
@@ -234,7 +224,7 @@
materials[ i ] = mm;
- } else if ( m.name.indexOf( "Material.001" ) !== -1 ) {
+ } else if ( m.name.indexOf( "Material.001" ) !== - 1 ) {
var mm = new THREE.MeshPhongMaterial( { map: m.map } );
@@ -255,7 +245,7 @@
//
- function onWindowResize( event ) {
+ function onWindowResize() {
SCREEN_WIDTH = window.innerWidth;
SCREEN_HEIGHT = window.innerHeight;
@@ -267,14 +257,6 @@
}
-
- function onDocumentMouseMove(event) {
-
- mouseX = ( event.clientX - windowHalfX );
- mouseY = ( event.clientY - windowHalfY );
-
- }
-
//
function animate() { | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_draco.html | @@ -43,9 +43,11 @@
var camera, scene, renderer;
+ var container = document.querySelector( '#container' );
+
// Configure and create Draco decoder.
- THREE.DRACOLoader.setDecoderPath('js/libs/draco/');
- THREE.DRACOLoader.setDecoderConfig({type: 'js'});
+ THREE.DRACOLoader.setDecoderPath( 'js/libs/draco/' );
+ THREE.DRACOLoader.setDecoderConfig( { type: 'js' } );
var dracoLoader = new THREE.DRACOLoader();
init();
animate();
@@ -67,7 +69,7 @@
plane.rotation.x = - Math.PI / 2;
plane.position.y = 0.03;
plane.receiveShadow = true;
- scene.add(plane);
+ scene.add( plane );
// Lights
var light = new THREE.HemisphereLight( 0x443333, 0x111122 ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_fbx.html | @@ -86,8 +86,8 @@
light.position.set( 0, 200, 100 );
light.castShadow = true;
light.shadow.camera.top = 180;
- light.shadow.camera.bottom = -100;
- light.shadow.camera.left = -120;
+ light.shadow.camera.bottom = - 100;
+ light.shadow.camera.left = - 120;
light.shadow.camera.right = 120;
scene.add( light );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_fbx_nurbs.html | @@ -90,7 +90,7 @@
// model
var loader = new THREE.FBXLoader();
- loader.load( 'models/fbx/nurbs.fbx', function( object ) {
+ loader.load( 'models/fbx/nurbs.fbx', function ( object ) {
scene.add( object );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_gcode.html | @@ -36,7 +36,7 @@
<script>
- var container, controls;
+ var container;
var camera, scene, renderer;
init();
@@ -47,20 +47,20 @@
container = document.createElement( 'div' );
document.body.appendChild( container );
- camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 10000);
+ camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 10000 );
camera.position.set( 0, 0, 50 );
- controls = new THREE.OrbitControls( camera );
+ var controls = new THREE.OrbitControls( camera );
scene = new THREE.Scene();
var loader = new THREE.GCodeLoader();
loader.load( 'models/gcode/benchy.gcode', function ( object ) {
- object.position.set( -100, -20, 100 );
+ object.position.set( - 100, - 20, 100 );
scene.add( object );
- });
+ } );
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_gltf.html | @@ -63,10 +63,10 @@
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.25, 20 );
- camera.position.set( -1.8, 0.9, 2.7 );
+ camera.position.set( - 1.8, 0.9, 2.7 );
controls = new THREE.OrbitControls( camera );
- controls.target.set( 0, -0.2, -0.2 );
+ controls.target.set( 0, - 0.2, - 0.2 );
controls.update();
// envmap | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_gltf_extensions.html | @@ -282,7 +282,7 @@
var loadStartTime = performance.now();
- loader.load( url, function( data ) {
+ loader.load( url, function ( data ) {
gltf = data;
@@ -331,7 +331,7 @@
if ( ! envMap ) envMap = getEnvMap();
- object.traverse( function( node ) {
+ object.traverse( function ( node ) {
if ( node.material && ( node.material.isMeshStandardMaterial ||
( node.material.isShaderMaterial && node.material.envMap !== undefined ) ) ) { | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_imagebitmap.html | @@ -67,10 +67,14 @@
addCube( material );
- }, function( p ) {
+ }, function ( p ) {
+
console.log( p );
- }, function( e ) {
+
+ }, function ( e ) {
+
console.log( e );
+
} );
}
@@ -80,14 +84,16 @@
new THREE.ImageLoader()
.setCrossOrigin( '*' )
.load( 'textures/planets/earth_atmos_2048.jpg?' + performance.now(), function ( image ) {
- var texture = new THREE.CanvasTexture( image );
- var material = new THREE.MeshBasicMaterial( { color: 0xff8888, map: texture } );
- addCube( material );
- });
+
+ var texture = new THREE.CanvasTexture( image );
+ var material = new THREE.MeshBasicMaterial( { color: 0xff8888, map: texture } );
+ addCube( material );
+
+ } );
}
- var geometry = new THREE.BoxBufferGeometry( 1,1,1 );
+ var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
function addCube( material ) {
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_json.html | @@ -51,7 +51,7 @@
}
var container, stats, clock, mixer;
- var camera, scene, renderer, objects;
+ var camera, scene, renderer;
init();
animate();
@@ -85,25 +85,25 @@
// random placement in a grid
- var x = ( ( i % 27 ) - 13.5 ) * 2 + THREE.Math.randFloatSpread( 1 );
+ var x = ( ( i % 27 ) - 13.5 ) * 2 + THREE.Math.randFloatSpread( 1 );
var z = ( Math.floor( i / 27 ) - 13.5 ) * 2 + THREE.Math.randFloatSpread( 1 );
mesh.position.set( x, 0, z );
var s = THREE.Math.randFloat( 0.00075, 0.001 );
mesh.scale.set( s, s, s );
- mesh.rotation.y = THREE.Math.randFloat( -0.25, 0.25 );
+ mesh.rotation.y = THREE.Math.randFloat( - 0.25, 0.25 );
mesh.matrixAutoUpdate = false;
mesh.updateMatrix();
scene.add( mesh );
mixer.clipAction( geometry.animations[ 0 ], mesh )
- .setDuration( 1 ) // one second
- .startAt( - Math.random() ) // random phase (already running)
- .play(); // let's go
+ .setDuration( 1 ) // one second
+ .startAt( - Math.random() ) // random phase (already running)
+ .play(); // let's go
}
@@ -138,7 +138,7 @@
//
- function onWindowResize( event ) {
+ function onWindowResize() {
renderer.setSize( window.innerWidth, window.innerHeight );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_json_claraio.html | @@ -73,8 +73,10 @@
// BEGIN Clara.io JSON loader code
var objectLoader = new THREE.ObjectLoader();
- objectLoader.load("models/json/teapot-claraio.json", function ( obj ) {
+ objectLoader.load( "models/json/teapot-claraio.json", function ( obj ) {
+
scene.add( obj );
+
} );
// END Clara.io JSON loader code
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_kmz.html | @@ -23,14 +23,11 @@
}
- a { color: skyblue }
- .button { background:#999; color:#eee; padding:0.2em 0.5em; cursor:pointer }
- .highlight { background:orange; color:#fff; }
+ a { color: red }
span {
display: inline-block;
width: 60px;
- float: left;
text-align: center;
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_md2.html | @@ -110,7 +110,7 @@
scene.add( light );
var light = new THREE.SpotLight( 0xffffff, 5, 1000 );
- light.position.set( -100, 350, 350 );
+ light.position.set( - 100, 350, 350 );
light.angle = 0.5;
light.penumbra = 0.5;
@@ -167,13 +167,13 @@
gui = new dat.GUI();
- gui.add( playbackConfig, 'speed', 0, 2 ).onChange( function() {
+ gui.add( playbackConfig, 'speed', 0, 2 ).onChange( function () {
character.setPlaybackRate( playbackConfig.speed );
} );
- gui.add( playbackConfig, 'wireframe', false ).onChange( function() {
+ gui.add( playbackConfig, 'wireframe', false ).onChange( function () {
character.setWireframe( playbackConfig.wireframe );
@@ -187,7 +187,7 @@
body: "ratamahatta.md2",
skins: [ "ratamahatta.png", "ctf_b.png", "ctf_r.png", "dead.png", "gearwhore.png" ],
- weapons: [ [ "weapon.md2", "weapon.png" ],
+ weapons: [[ "weapon.md2", "weapon.png" ],
[ "w_bfg.md2", "w_bfg.png" ],
[ "w_blaster.md2", "w_blaster.png" ],
[ "w_chaingun.md2", "w_chaingun.png" ],
@@ -198,20 +198,20 @@
[ "w_rlauncher.md2", "w_rlauncher.png" ],
[ "w_shotgun.md2", "w_shotgun.png" ],
[ "w_sshotgun.md2", "w_sshotgun.png" ]
- ]
+ ]
};
character = new THREE.MD2Character();
character.scale = 3;
- character.onLoadComplete = function() {
+ character.onLoadComplete = function () {
setupSkinsGUI( character );
setupWeaponsGUI( character );
setupGUIAnimations( character );
- character.setAnimation( character.meshBody.geometry.animations[0].name )
+ character.setAnimation( character.meshBody.geometry.animations[ 0 ].name );
};
@@ -223,14 +223,14 @@
// EVENT HANDLERS
- function onWindowResize( event ) {
+ function onWindowResize() {
SCREEN_WIDTH = window.innerWidth;
SCREEN_HEIGHT = window.innerHeight;
renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
- camera.aspect = SCREEN_WIDTH/ SCREEN_HEIGHT;
+ camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
camera.updateProjectionMatrix();
}
@@ -258,9 +258,13 @@
var folder = gui.addFolder( "Weapons" );
- var generateCallback = function( index ) {
+ var generateCallback = function ( index ) {
- return function () { character.setWeapon( index ); };
+ return function () {
+
+ character.setWeapon( index );
+
+ };
};
@@ -283,9 +287,13 @@
var folder = gui.addFolder( "Skins" );
- var generateCallback = function( index ) {
+ var generateCallback = function ( index ) {
+
+ return function () {
- return function () { character.setSkin( index ); };
+ character.setSkin( index );
+
+ };
};
@@ -308,9 +316,13 @@
var folder = gui.addFolder( "Animations" );
- var generateCallback = function( animationClip ) {
+ var generateCallback = function ( animationClip ) {
+
+ return function () {
+
+ character.setAnimation( animationClip.name );
- return function () { character.setAnimation( animationClip.name ); };
+ };
};
@@ -319,7 +331,7 @@
for ( var i = 0; i < animations.length; i ++ ) {
- var clip = animations[i];
+ var clip = animations[ i ];
playbackConfig[ clip.name ] = generateCallback( clip );
guiItems[ i ] = folder.add( playbackConfig, clip.name, clip.name ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_md2_control.html | @@ -114,10 +114,10 @@
light.shadow.camera.near = 100;
light.shadow.camera.far = 1200;
- light.shadow.camera.left = -1000;
+ light.shadow.camera.left = - 1000;
light.shadow.camera.right = 1000;
light.shadow.camera.top = 350;
- light.shadow.camera.bottom = -350;
+ light.shadow.camera.bottom = - 350;
scene.add( light );
// scene.add( new THREE.CameraHelper( light.shadow.camera ) );
@@ -181,7 +181,7 @@
skins: [ "grok.jpg", "ogrobase.png", "arboshak.png", "ctf_r.png", "ctf_b.png", "darkam.png", "freedom.png",
"gib.png", "gordogh.png", "igdosh.png", "khorne.png", "nabogro.png",
"sharokh.png" ],
- weapons: [ [ "weapon.md2", "weapon.jpg" ] ],
+ weapons: [[ "weapon.md2", "weapon.jpg" ]],
animations: {
move: "run",
idle: "stand",
@@ -232,7 +232,7 @@
cloneCharacter.setWeapon( 0 );
cloneCharacter.setSkin( i );
- cloneCharacter.root.position.x = ( i - nSkins/2 ) * 150;
+ cloneCharacter.root.position.x = ( i - nSkins / 2 ) * 150;
cloneCharacter.root.position.z = j * 250;
scene.add( cloneCharacter.root );
@@ -257,23 +257,23 @@
// EVENT HANDLERS
- function onWindowResize( event ) {
+ function onWindowResize() {
SCREEN_WIDTH = window.innerWidth;
SCREEN_HEIGHT = window.innerHeight;
renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
- camera.aspect = SCREEN_WIDTH/ SCREEN_HEIGHT;
+ camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
camera.updateProjectionMatrix();
}
- function onKeyDown ( event ) {
+ function onKeyDown( event ) {
event.stopPropagation();
- switch( event.keyCode ) {
+ switch ( event.keyCode ) {
case 38: /*up*/
case 87: /*W*/ controls.moveForward = true; break;
@@ -282,10 +282,10 @@
case 83: /*S*/ controls.moveBackward = true; break;
case 37: /*left*/
- case 65: /*A*/ controls.moveLeft = true; break;
+ case 65: /*A*/ controls.moveLeft = true; break;
case 39: /*right*/
- case 68: /*D*/ controls.moveRight = true; break;
+ case 68: /*D*/ controls.moveRight = true; break;
//case 67: /*C*/ controls.crouch = true; break;
//case 32: /*space*/ controls.jump = true; break;
@@ -295,11 +295,11 @@
}
- function onKeyUp ( event ) {
+ function onKeyUp( event ) {
event.stopPropagation();
- switch( event.keyCode ) {
+ switch ( event.keyCode ) {
case 38: /*up*/
case 87: /*W*/ controls.moveForward = false; break;
@@ -311,7 +311,7 @@
case 65: /*A*/ controls.moveLeft = false; break;
case 39: /*right*/
- case 68: /*D*/ controls.moveRight = false; break;
+ case 68: /*D*/ controls.moveRight = false; break;
//case 67: /*C*/ controls.crouch = false; break;
//case 32: /*space*/ controls.jump = false; break; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_mmd.html | @@ -57,11 +57,6 @@
var mesh, camera, scene, renderer, effect;
var helper, ikHelper, physicsHelper;
- var mouseX = 0, mouseY = 0;
-
- var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
-
var clock = new THREE.Clock();
init();
@@ -116,10 +111,8 @@
}
- };
+ }
- function onError( xhr ) {
- };
var modelFile = 'models/mmd/miku/miku_v2.pmd';
var vmdFiles = [ 'models/mmd/vmds/wavefile_v2.vmd' ];
@@ -151,7 +144,7 @@
initGui();
- }, onProgress, onError );
+ }, onProgress, null );
var controls = new THREE.OrbitControls( camera, renderer.domElement );
@@ -193,7 +186,9 @@
var gui = new dat.GUI();
gui.add( api, 'animation' ).onChange( function () {
+
helper.enable( 'animation', api[ 'animation' ] );
+
} );
gui.add( api, 'gradient mapping' ).onChange( function () {
@@ -214,23 +209,33 @@
} );
gui.add( api, 'ik' ).onChange( function () {
+
helper.enable( 'ik', api[ 'ik' ] );
+
} );
gui.add( api, 'outline' ).onChange( function () {
+
effect.enabled = api[ 'outline' ];
+
} );
gui.add( api, 'physics' ).onChange( function () {
+
helper.enable( 'physics', api[ 'physics' ] );
+
} );
gui.add( api, 'show IK bones' ).onChange( function () {
+
ikHelper.visible = api[ 'show IK bones' ];
+
} );
gui.add( api, 'show rigid bodies' ).onChange( function () {
+
if ( physicsHelper !== undefined ) physicsHelper.visible = api[ 'show rigid bodies' ];
+
} );
}
@@ -239,9 +244,6 @@
function onWindowResize() {
- windowHalfX = window.innerWidth / 2;
- windowHalfY = window.innerHeight / 2;
-
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_mmd_audio.html | @@ -51,18 +51,13 @@
<script>
- var container, stats;
+ var container;
var mesh, camera, scene, renderer, effect;
var helper;
var ready = false;
- var mouseX = 0, mouseY = 0;
-
- var windowHalfX = window.innerWidth / 2;
- var windowHalfY = window.innerHeight / 2;
-
var clock = new THREE.Clock();
init();
@@ -109,10 +104,7 @@
}
- };
-
- function onError( xhr ) {
- };
+ }
var modelFile = 'models/mmd/miku/miku_v2.pmd';
var vmdFiles = [ 'models/mmd/vmds/wavefile_v2.vmd' ];
@@ -154,13 +146,11 @@
ready = true;
- }, onProgress, onError );
-
- }, onProgress, onError );
+ }, onProgress, null );
- }, onProgress, onError );
+ }, onProgress, null );
- document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+ }, onProgress, null );
//
@@ -170,23 +160,13 @@
function onWindowResize() {
- windowHalfX = window.innerWidth / 2;
- windowHalfY = window.innerHeight / 2;
-
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
effect.setSize( window.innerWidth, window.innerHeight );
}
- function onDocumentMouseMove( event ) {
-
- mouseX = ( event.clientX - windowHalfX ) / 2;
- mouseY = ( event.clientY - windowHalfY ) / 2;
-
- }
-
//
function animate() { | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_mmd_pose.html | @@ -50,15 +50,13 @@
<script>
- var container, stats;
+ var container;
var camera, scene, renderer, effect;
var mesh, helper;
var vpds = [];
- var clock = new THREE.Clock();
-
init();
animate();
@@ -102,10 +100,7 @@
}
- };
-
- function onError( xhr ) {
- };
+ }
var modelFile = 'models/mmd/miku/miku_v2.pmd';
var vpdFiles = [
@@ -155,13 +150,13 @@
}
- }, onProgress, onError );
+ }, onProgress, null );
}
loadVpd();
- }, onProgress, onError );
+ }, onProgress, null );
//
@@ -195,7 +190,7 @@
controls.pose = - 1;
- for ( var i = 0; i < vpdFiles.length; i++ ) {
+ for ( var i = 0; i < vpdFiles.length; i ++ ) {
controls[ getBaseName( vpdFiles[ i ] ) ] = false;
@@ -217,7 +212,7 @@
var files = { default: - 1 };
- for ( var i = 0; i < vpdFiles.length; i++ ) {
+ for ( var i = 0; i < vpdFiles.length; i ++ ) {
files[ getBaseName( vpdFiles[ i ] ) ] = i;
@@ -239,7 +234,7 @@
function onChangeMorph() {
- for ( var i = 0; i < keys.length; i++ ) {
+ for ( var i = 0; i < keys.length; i ++ ) {
var key = keys[ i ];
var value = controls[ key ]; | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_nrrd.html | @@ -75,7 +75,6 @@
controls,
scene,
renderer,
- gui,
container2,
renderer2,
camera2,
@@ -90,8 +89,6 @@
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.01, 1e10 );
camera.position.z = 300;
-
-
scene = new THREE.Scene();
scene.add( camera );
@@ -106,6 +103,7 @@
var loader = new THREE.NRRDLoader();
loader.load( "models/nrrd/I.nrrd", function ( volume ) {
+
var geometry,
material,
sliceZ,
@@ -119,41 +117,61 @@
cube.visible = false;
var box = new THREE.BoxHelper( cube );
scene.add( box );
- box.applyMatrix(volume.matrix);
+ box.applyMatrix( volume.matrix );
scene.add( cube );
//z plane
- sliceZ = volume.extractSlice('z',Math.floor(volume.RASDimensions[2]/4));
+ sliceZ = volume.extractSlice( 'z', Math.floor( volume.RASDimensions[ 2 ] / 4 ) );
scene.add( sliceZ.mesh );
//y plane
- sliceY = volume.extractSlice('y',Math.floor(volume.RASDimensions[1]/2));
+ sliceY = volume.extractSlice( 'y', Math.floor( volume.RASDimensions[ 1 ] / 2 ) );
scene.add( sliceY.mesh );
//x plane
- sliceX = volume.extractSlice('x',Math.floor(volume.RASDimensions[0]/2));
+ sliceX = volume.extractSlice( 'x', Math.floor( volume.RASDimensions[ 0 ] / 2 ) );
scene.add( sliceX.mesh );
- gui.add( sliceX, "index", 0, volume.RASDimensions[0], 1 ).name( "indexX" ).onChange( function () {sliceX.repaint.call(sliceX);} );
- gui.add( sliceY, "index", 0, volume.RASDimensions[1], 1 ).name( "indexY" ).onChange( function () {sliceY.repaint.call(sliceY);} );
- gui.add( sliceZ, "index", 0, volume.RASDimensions[2], 1 ).name( "indexZ" ).onChange( function () {sliceZ.repaint.call(sliceZ);} );
+ gui.add( sliceX, "index", 0, volume.RASDimensions[ 0 ], 1 ).name( "indexX" ).onChange( function () {
+
+ sliceX.repaint.call( sliceX );
+
+ } );
+ gui.add( sliceY, "index", 0, volume.RASDimensions[ 1 ], 1 ).name( "indexY" ).onChange( function () {
+
+ sliceY.repaint.call( sliceY );
+
+ } );
+ gui.add( sliceZ, "index", 0, volume.RASDimensions[ 2 ], 1 ).name( "indexZ" ).onChange( function () {
+
+ sliceZ.repaint.call( sliceZ );
+
+ } );
+
+ gui.add( volume, "lowerThreshold", volume.min, volume.max, 1 ).name( "Lower Threshold" ).onChange( function () {
- gui.add( volume, "lowerThreshold", volume.min, volume.max, 1).name( "Lower Threshold").onChange( function () {
volume.repaintAllSlices();
- });
- gui.add( volume, "upperThreshold", volume.min, volume.max, 1).name( "Upper Threshold").onChange( function () {
+
+ } );
+ gui.add( volume, "upperThreshold", volume.min, volume.max, 1 ).name( "Upper Threshold" ).onChange( function () {
+
volume.repaintAllSlices();
- });
- gui.add( volume, "windowLow", volume.min, volume.max, 1).name( "Window Low").onChange( function () {
+
+ } );
+ gui.add( volume, "windowLow", volume.min, volume.max, 1 ).name( "Window Low" ).onChange( function () {
+
volume.repaintAllSlices();
- });
- gui.add( volume, "windowHigh", volume.min, volume.max, 1).name( "Window High").onChange( function () {
+
+ } );
+ gui.add( volume, "windowHigh", volume.min, volume.max, 1 ).name( "Window High" ).onChange( function () {
+
volume.repaintAllSlices();
- });
+
+ } );
} );
- var vtkmaterial = new THREE.MeshLambertMaterial( {wireframe : false, morphTargets : false, side : THREE.DoubleSide, color : 0xff0000} );
+ var vtkmaterial = new THREE.MeshLambertMaterial( { wireframe: false, morphTargets: false, side: THREE.DoubleSide, color: 0xff0000 } );
var vtkloader = new THREE.VTKLoader();
vtkloader.load( "models/vtk/liver.vtk", function ( geometry ) {
@@ -163,12 +181,14 @@
var mesh = new THREE.Mesh( geometry, vtkmaterial );
scene.add( mesh );
var visibilityControl = {
- visible : true
+ visible: true
};
- gui.add(visibilityControl, "visible").name( "Model Visible").onChange( function () {
+ gui.add( visibilityControl, "visible" ).name( "Model Visible" ).onChange( function () {
+
mesh.visible = visibilityControl.visible;
renderer.render( scene, camera );
- });
+
+ } );
} );
// renderer
@@ -225,29 +245,22 @@
camera2.lookAt( scene2.position );
renderer.render( scene, camera );
- renderer2.render( scene2, camera2);
+ renderer2.render( scene2, camera2 );
stats.update();
}
- function rotateAroundWorldAxis(object, axis, radians) {
- var rotWorldMatrix = new THREE.Matrix4();
- rotWorldMatrix.makeRotationAxis(axis.normalize(), radians);
-
- object.applyMatrix(rotWorldMatrix);
-
- }
+ function setupInset() {
- function setupInset () {
var insetWidth = 150,
insetHeight = 150;
- container2 = document.getElementById('inset');
+ container2 = document.getElementById( 'inset' );
container2.width = insetWidth;
container2.height = insetHeight;
// renderer
- renderer2 = new THREE.WebGLRenderer({alpha : true});
+ renderer2 = new THREE.WebGLRenderer( { alpha: true } );
renderer2.setClearColor( 0x000000, 0 );
renderer2.setSize( insetWidth, insetHeight );
container2.appendChild( renderer2.domElement );
@@ -262,8 +275,8 @@
// axes
axes2 = new THREE.AxesHelper( 100 );
scene2.add( axes2 );
- }
+ }
</script>
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_obj.html | @@ -111,7 +111,7 @@
}
- function onError( xhr ) {}
+ function onError() {}
var loader = new THREE.OBJLoader( manager );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_obj2.html | @@ -83,11 +83,12 @@
'use strict';
- var OBJLoader2Example = (function () {
+ var OBJLoader2Example = ( function () {
var Validator = THREE.LoaderSupport.Validator;
function OBJLoader2Example( elementToBindTo ) {
+
this.renderer = null;
this.canvas = elementToBindTo;
this.aspectRatio = 1;
@@ -105,9 +106,11 @@
this.cameraTarget = this.cameraDefaults.posCameraTarget;
this.controls = null;
+
}
OBJLoader2Example.prototype.initGL = function () {
+
this.renderer = new THREE.WebGLRenderer( {
canvas: this.canvas,
antialias: true,
@@ -125,89 +128,112 @@
var directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
var directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
- directionalLight1.position.set( -100, -50, 100 );
- directionalLight2.position.set( 100, 50, -100 );
+ directionalLight1.position.set( - 100, - 50, 100 );
+ directionalLight2.position.set( 100, 50, - 100 );
this.scene.add( directionalLight1 );
this.scene.add( directionalLight2 );
this.scene.add( ambientLight );
var helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
this.scene.add( helper );
+
};
OBJLoader2Example.prototype.initContent = function () {
+
var modelName = 'female02';
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
var scope = this;
var objLoader = new THREE.OBJLoader2();
var callbackOnLoad = function ( event ) {
+
scope.scene.add( event.detail.loaderRootNode );
console.log( 'Loading complete: ' + event.detail.modelName );
scope._reportProgress( { detail: { text: '' } } );
+
};
var onLoadMtl = function ( materials ) {
+
objLoader.setModelName( modelName );
objLoader.setMaterials( materials );
objLoader.setLogging( true, true );
objLoader.load( 'models/obj/female02/female02.obj', callbackOnLoad, null, null, null, false );
+
};
objLoader.loadMtl( 'models/obj/female02/female02.mtl', null, onLoadMtl );
+
};
- OBJLoader2Example.prototype._reportProgress = function( event ) {
+ OBJLoader2Example.prototype._reportProgress = function ( event ) {
+
var output = Validator.verifyInput( event.detail.text, '' );
console.log( 'Progress: ' + output );
document.getElementById( 'feedback' ).innerHTML = output;
+
};
OBJLoader2Example.prototype.resizeDisplayGL = function () {
+
this.controls.handleResize();
this.recalcAspectRatio();
this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
this.updateCamera();
+
};
OBJLoader2Example.prototype.recalcAspectRatio = function () {
+
this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
+
};
OBJLoader2Example.prototype.resetCamera = function () {
+
this.camera.position.copy( this.cameraDefaults.posCamera );
this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
this.updateCamera();
+
};
OBJLoader2Example.prototype.updateCamera = function () {
+
this.camera.aspect = this.aspectRatio;
this.camera.lookAt( this.cameraTarget );
this.camera.updateProjectionMatrix();
+
};
OBJLoader2Example.prototype.render = function () {
+
if ( ! this.renderer.autoClear ) this.renderer.clear();
this.controls.update();
this.renderer.render( this.scene, this.camera );
+
};
return OBJLoader2Example;
- })();
+ } )();
var app = new OBJLoader2Example( document.getElementById( 'example' ) );
var resizeWindow = function () {
+
app.resizeDisplayGL();
+
};
var render = function () {
+
requestAnimationFrame( render );
app.render();
+
};
window.addEventListener( 'resize', resizeWindow, false ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_obj2_meshspray.html | @@ -82,11 +82,12 @@
'use strict';
- var MeshSpray = (function () {
+ var MeshSpray = ( function () {
var Validator = THREE.LoaderSupport.Validator;
function MeshSpray( manager ) {
+
this.manager = Validator.verifyInput( manager, THREE.DefaultLoadingManager );
this.logging = {
enabled: true,
@@ -99,19 +100,24 @@
this.meshBuilder = new THREE.LoaderSupport.MeshBuilder();
this.callbacks = new THREE.LoaderSupport.Callbacks();
this.workerSupport = null;
+
}
MeshSpray.prototype.setLogging = function ( enabled, debug ) {
+
this.logging.enabled = enabled === true;
this.logging.debug = debug === true;
this.meshBuilder.setLogging( this.logging.enabled, this.logging.debug );
+
};
MeshSpray.prototype.setStreamMeshesTo = function ( streamMeshesTo ) {
+
this.loaderRootNode = Validator.verifyInput( streamMeshesTo, this.loaderRootNode );
+
};
- MeshSpray.prototype.setForceWorkerDataCopy = function ( forceWorkerDataCopy ) {
+ MeshSpray.prototype.setForceWorkerDataCopy = function () {
// nothing to do here
};
@@ -136,14 +142,19 @@
var scope = this;
var scopeBuilderFunc = function ( payload ) {
+
var meshes = scope.meshBuilder.processPayload( payload );
var mesh;
for ( var i in meshes ) {
+
mesh = meshes[ i ];
scope.loaderRootNode.add( mesh );
+
}
+
};
- var scopeFuncComplete = function ( message ) {
+ var scopeFuncComplete = function () {
+
var callback = scope.callbacks.onLoad;
if ( THREE.LoaderSupport.Validator.isValid( callback ) ) callback(
{
@@ -155,9 +166,11 @@
}
);
if ( scope.logging.enabled ) console.timeEnd( 'MeshSpray' + scope.instanceNo );
+
};
var buildCode = function ( funcBuildObject, funcBuildSingleton ) {
+
var workerCode = '';
workerCode += '/**\n';
workerCode += ' * This code was constructed by MeshSpray buildCode.\n';
@@ -167,6 +180,7 @@
workerCode += funcBuildSingleton( 'Parser', Parser );
return workerCode;
+
};
var libs2Load = [ 'build/three.min.js' ];
this.workerSupport.validate( buildCode, 'Parser', libs2Load, '../' );
@@ -191,9 +205,11 @@
}
}
);
+
};
MeshSpray.prototype._applyPrepData = function ( prepData ) {
+
if ( Validator.isValid( prepData ) ) {
this.setLogging( prepData.logging.enabled, prepData.logging.debug );
@@ -202,22 +218,24 @@
this._setCallbacks( prepData.getCallbacks() );
}
+
};
MeshSpray.prototype._setCallbacks = function ( callbacks ) {
+
if ( Validator.isValid( callbacks.onProgress ) ) this.callbacks.setCallbackOnProgress( callbacks.onProgress );
if ( Validator.isValid( callbacks.onMeshAlter ) ) this.callbacks.setCallbackOnMeshAlter( callbacks.onMeshAlter );
if ( Validator.isValid( callbacks.onLoad ) ) this.callbacks.setCallbackOnLoad( callbacks.onLoad );
if ( Validator.isValid( callbacks.onLoadMaterials ) ) this.callbacks.setCallbackOnLoadMaterials( callbacks.onLoadMaterials );
this.meshBuilder._setCallbacks( this.callbacks );
- };
-
+ };
- var Parser = ( function () {
+ var Parser = ( function () {
function Parser() {
+
this.sizeFactor = 0.5;
this.localOffsetFactor = 1.0;
this.globalObjectCount = 0;
@@ -231,15 +249,19 @@
enabled: true,
debug: false
};
- };
+
+ }
Parser.prototype.setLogging = function ( enabled, debug ) {
+
this.logging.enabled = enabled === true;
this.logging.debug = debug === true;
+
};
Parser.prototype.parse = function () {
- var baseTriangle = [ 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 0.0, -1.0, 1.0 ];
+
+ var baseTriangle = [ 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 0.0, - 1.0, 1.0 ];
var vertices = [];
var colors = [];
var normals = [];
@@ -254,7 +276,8 @@
// local coords offset
var localOffsetFactor = this.localOffsetFactor;
- for ( var i = 0; i < this.quantity; i++ ) {
+ for ( var i = 0; i < this.quantity; i ++ ) {
+
var sizeVaring = this.sizeFactor * Math.random();
s = 2 * Math.PI * Math.random();
@@ -264,13 +287,16 @@
fixedOffsetY = dimensionHalf * Math.random() * Math.sin( s ) * Math.sin( t );
fixedOffsetZ = dimensionHalf * Math.random() * Math.cos( t );
for ( var j = 0; j < baseTriangle.length; j += 3 ) {
+
vertices.push( baseTriangle[ j ] * sizeVaring + localOffsetFactor * Math.random() + fixedOffsetX );
vertices.push( baseTriangle[ j + 1 ] * sizeVaring + localOffsetFactor * Math.random() + fixedOffsetY );
vertices.push( baseTriangle[ j + 2 ] * sizeVaring + localOffsetFactor * Math.random() + fixedOffsetZ );
colors.push( Math.random() );
colors.push( Math.random() );
colors.push( Math.random() );
+
}
+
}
var absoluteVertexCount = vertices.length;
@@ -325,7 +351,7 @@
};
this.callbackMeshBuilder( payload );
- this.globalObjectCount++;
+ this.globalObjectCount ++;
this.callbackMeshBuilder(
{
cmd: 'meshData',
@@ -354,27 +380,32 @@
);
if ( this.logging.enabled ) console.info( 'Global output object count: ' + this.globalObjectCount );
+
};
return Parser;
- })();
+
+ } )();
Parser.prototype.setSerializedMaterials = function ( serializedMaterials ) {
+
if ( THREE.LoaderSupport.Validator.isValid( serializedMaterials ) ) {
this.serializedMaterials = serializedMaterials;
}
+
};
return MeshSpray;
- })();
+ } )();
- var MeshSprayApp = (function () {
+ var MeshSprayApp = ( function () {
function MeshSprayApp( elementToBindTo ) {
+
this.renderer = null;
this.canvas = elementToBindTo;
this.aspectRatio = 1;
@@ -395,9 +426,11 @@
this.cube = null;
this.pivot = null;
+
}
MeshSprayApp.prototype.initGL = function () {
+
this.renderer = new THREE.WebGLRenderer( {
canvas: this.canvas,
antialias: true,
@@ -415,8 +448,8 @@
var directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
var directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
- directionalLight1.position.set( -100, -50, 100 );
- directionalLight2.position.set( 100, 50, -100 );
+ directionalLight1.position.set( - 100, - 50, 100 );
+ directionalLight2.position.set( 100, 50, - 100 );
this.scene.add( directionalLight1 );
this.scene.add( directionalLight2 );
@@ -434,9 +467,11 @@
this.pivot = new THREE.Object3D();
this.pivot.name = 'Pivot';
this.scene.add( this.pivot );
+
};
MeshSprayApp.prototype.initContent = function () {
+
var maxQueueSize = 1024;
var maxWebWorkers = 4;
var radius = 640;
@@ -445,13 +480,18 @@
workerDirector.setCrossOrigin( 'anonymous' );
var callbackOnLoad = function ( event ) {
+
console.info( 'Worker #' + event.detail.instanceNo + ': Completed loading. (#' + workerDirector.objectsCompleted + ')' );
+
};
- var reportProgress = function( event ) {
+ var reportProgress = function ( event ) {
+
document.getElementById( 'feedback' ).innerHTML = event.detail.text;
console.info( event.detail.text );
+
};
var callbackMeshAlter = function ( event ) {
+
var override = new THREE.LoaderSupport.LoadedMeshUserOverride( false, true );
event.detail.side = THREE.DoubleSide;
@@ -460,8 +500,8 @@
override.addMesh( mesh );
return override;
- };
+ };
var callbacks = new THREE.LoaderSupport.Callbacks();
callbacks.setCallbackOnMeshAlter( callbackMeshAlter );
@@ -473,7 +513,8 @@
var pivot;
var s, t, r, x, y, z;
var globalObjectCount = 0;
- for ( var i = 0; i < maxQueueSize; i++ ) {
+ for ( var i = 0; i < maxQueueSize; i ++ ) {
+
prepData = new THREE.LoaderSupport.PrepData( 'Triangles_' + i );
pivot = new THREE.Object3D();
@@ -490,40 +531,51 @@
prepData.quantity = 8192;
prepData.dimension = Math.max( Math.random() * 500, 100 );
- prepData.globalObjectCount = globalObjectCount++;
+ prepData.globalObjectCount = globalObjectCount ++;
workerDirector.enqueueForRun( prepData );
+
}
workerDirector.processQueue();
+
};
MeshSprayApp.prototype.resizeDisplayGL = function () {
+
this.controls.handleResize();
this.recalcAspectRatio();
this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
this.updateCamera();
+
};
MeshSprayApp.prototype.recalcAspectRatio = function () {
+
this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
+
};
MeshSprayApp.prototype.resetCamera = function () {
+
this.camera.position.copy( this.cameraDefaults.posCamera );
this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
this.updateCamera();
+
};
MeshSprayApp.prototype.updateCamera = function () {
+
this.camera.aspect = this.aspectRatio;
this.camera.lookAt( this.cameraTarget );
this.camera.updateProjectionMatrix();
+
};
MeshSprayApp.prototype.render = function () {
+
if ( ! this.renderer.autoClear ) this.renderer.clear();
this.controls.update();
@@ -532,22 +584,27 @@
this.cube.rotation.y += 0.05;
this.renderer.render( this.scene, this.camera );
+
};
return MeshSprayApp;
- })();
+ } )();
var app = new MeshSprayApp( document.getElementById( 'example' ) );
// init three.js example application
var resizeWindow = function () {
+
app.resizeDisplayGL();
+
};
var render = function () {
+
requestAnimationFrame( render );
app.render();
+
};
window.addEventListener( 'resize', resizeWindow, false ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_obj2_options.html | @@ -83,11 +83,12 @@
'use strict';
- var WWOBJLoader2Example = (function () {
+ var WWOBJLoader2Example = ( function () {
var Validator = THREE.LoaderSupport.Validator;
function WWOBJLoader2Example( elementToBindTo ) {
+
this.renderer = null;
this.canvas = elementToBindTo;
this.aspectRatio = 1;
@@ -111,9 +112,11 @@
this.cube = null;
this.pivot = null;
+
}
WWOBJLoader2Example.prototype.initGL = function () {
+
this.renderer = new THREE.WebGLRenderer( {
canvas: this.canvas,
antialias: true,
@@ -131,8 +134,8 @@
var directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
var directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
- directionalLight1.position.set( -100, -50, 100 );
- directionalLight2.position.set( 100, 50, -100 );
+ directionalLight1.position.set( - 100, - 50, 100 );
+ directionalLight2.position.set( 100, 50, - 100 );
this.scene.add( directionalLight1 );
this.scene.add( directionalLight2 );
@@ -150,15 +153,18 @@
this.pivot = new THREE.Object3D();
this.pivot.name = 'Pivot';
this.scene.add( this.pivot );
+
};
WWOBJLoader2Example.prototype.useParseSync = function () {
+
var modelName = 'female02';
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
var scope = this;
var objLoader = new THREE.OBJLoader2();
var onLoadMtl = function ( materials ) {
+
objLoader.setModelName( modelName );
objLoader.setMaterials( materials );
@@ -167,32 +173,38 @@
fileLoader.setResponseType( 'arraybuffer' );
fileLoader.load( 'models/obj/female02/female02.obj',
function ( content ) {
+
var local = new THREE.Object3D();
local.name = 'Pivot_female02';
local.position.set( 75, 0, 0 );
scope.pivot.add( local );
local.add( objLoader.parse( content ) );
scope._reportProgress( { detail: { text: 'Loading complete: ' + modelName } } );
+
}
);
+
};
objLoader.loadMtl( 'models/obj/female02/female02.mtl', null, onLoadMtl );
- };
+ };
WWOBJLoader2Example.prototype.useParseAsync = function () {
- var modelName = 'female02_vertex' ;
+
+ var modelName = 'female02_vertex';
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
var callbackOnLoad = function ( event ) {
+
var local = new THREE.Object3D();
local.name = 'Pivot_female02_vertex';
- local.position.set( -75, 0, 0 );
+ local.position.set( - 75, 0, 0 );
scope.pivot.add( local );
local.add( event.detail.loaderRootNode );
scope._reportProgress( { detail: { text: 'Loading complete: ' + event.detail.modelName } } );
+
};
var scope = this;
@@ -205,70 +217,87 @@
var filename = 'models/obj/female02/female02_vertex_colors.obj';
fileLoader.load( filename,
function ( content ) {
+
objLoader.parseAsync( content, callbackOnLoad );
scope._reportProgress( { detail: { text: 'File loading complete: ' + filename } } );
- }
- );
+
+ } );
+
};
WWOBJLoader2Example.prototype.useLoadSync = function () {
+
var modelName = 'male02';
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
var scope = this;
var objLoader = new THREE.OBJLoader2();
var callbackOnLoad = function ( event ) {
+
var local = new THREE.Object3D();
local.name = 'Pivot_male02';
- local.position.set( 0, 0, -75 );
+ local.position.set( 0, 0, - 75 );
scope.pivot.add( local );
local.add( event.detail.loaderRootNode );
scope._reportProgress( { detail: { text: 'Loading complete: ' + event.detail.modelName } } );
+
};
var onLoadMtl = function ( materials ) {
+
objLoader.setModelName( modelName );
objLoader.setMaterials( materials );
objLoader.setUseIndices( true );
objLoader.load( 'models/obj/male02/male02.obj', callbackOnLoad, null, null, null, false );
+
};
objLoader.loadMtl( 'models/obj/male02/male02.mtl', null, onLoadMtl );
+
};
WWOBJLoader2Example.prototype.useLoadAsync = function () {
+
var modelName = 'WaltHead';
this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
var scope = this;
var objLoader = new THREE.OBJLoader2();
var callbackOnLoad = function ( event ) {
+
objLoader.workerSupport.setTerminateRequested( true );
var local = new THREE.Object3D();
local.name = 'Pivot_WaltHead';
- local.position.set( -125, 50, 0 );
+ local.position.set( - 125, 50, 0 );
var scale = 0.5;
local.scale.set( scale, scale, scale );
scope.pivot.add( local );
local.add( event.detail.loaderRootNode );
scope._reportProgress( { detail: { text: 'Loading complete: ' + event.detail.modelName } } );
+
};
var onLoadMtl = function ( materials ) {
+
objLoader.setModelName( modelName );
objLoader.setMaterials( materials );
objLoader.terminateWorkerOnLoad = false;
objLoader.load( 'models/obj/walt/WaltHead.obj', callbackOnLoad, null, null, null, true );
+
};
objLoader.loadMtl( 'models/obj/walt/WaltHead.mtl', null, onLoadMtl );
+
};
WWOBJLoader2Example.prototype.useRunSync = function () {
+
var scope = this;
var callbackOnLoad = function ( event ) {
+
scope._reportProgress( { detail: { text: 'Loading complete: ' + event.detail.modelName } } );
+
};
var prepData = new THREE.LoaderSupport.PrepData( 'cerberus' );
@@ -284,12 +313,16 @@
var objLoader = new THREE.OBJLoader2();
objLoader.run( prepData );
+
};
WWOBJLoader2Example.prototype.useRunAsyncMeshAlter = function () {
+
var scope = this;
var callbackOnLoad = function ( event ) {
+
scope._reportProgress( { detail: { text: 'Loading complete: ' + event.detail.modelName } } );
+
};
var prepData = new THREE.LoaderSupport.PrepData( 'vive-controller' );
@@ -302,6 +335,7 @@
prepData.useAsync = true;
var callbacks = prepData.getCallbacks();
var callbackMeshAlter = function ( event ) {
+
var override = new THREE.LoaderSupport.LoadedMeshUserOverride( false, true );
var mesh = new THREE.Mesh( event.detail.bufferGeometry, event.detail.material );
@@ -315,52 +349,67 @@
override.addMesh( helper );
return override;
+
};
callbacks.setCallbackOnMeshAlter( callbackMeshAlter );
callbacks.setCallbackOnProgress( this._reportProgress );
callbacks.setCallbackOnLoad( callbackOnLoad );
var objLoader = new THREE.OBJLoader2();
objLoader.run( prepData );
+
};
WWOBJLoader2Example.prototype.finalize = function () {
+
this._reportProgress( { detail: { text: '' } } );
+
};
- WWOBJLoader2Example.prototype._reportProgress = function( event ) {
+ WWOBJLoader2Example.prototype._reportProgress = function ( event ) {
+
var output = Validator.verifyInput( event.detail.text, '' );
console.log( 'Progress: ' + output );
document.getElementById( 'feedback' ).innerHTML = output;
+
};
WWOBJLoader2Example.prototype.resizeDisplayGL = function () {
+
this.controls.handleResize();
this.recalcAspectRatio();
this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
this.updateCamera();
+
};
WWOBJLoader2Example.prototype.recalcAspectRatio = function () {
+
this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
+
};
WWOBJLoader2Example.prototype.resetCamera = function () {
+
this.camera.position.copy( this.cameraDefaults.posCamera );
this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
this.updateCamera();
+
};
WWOBJLoader2Example.prototype.updateCamera = function () {
+
this.camera.aspect = this.aspectRatio;
this.camera.lookAt( this.cameraTarget );
this.camera.updateProjectionMatrix();
+
};
WWOBJLoader2Example.prototype.render = function () {
+
if ( ! this.renderer.autoClear ) this.renderer.clear();
this.controls.update();
@@ -369,39 +418,53 @@
this.cube.rotation.y += 0.05;
this.renderer.render( this.scene, this.camera );
+
};
WWOBJLoader2Example.prototype.alterShading = function () {
+
var scope = this;
scope.flatShading = ! scope.flatShading;
- console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading');
+ console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading' );
scope.traversalFunction = function ( material ) {
+
material.flatShading = scope.flatShading;
material.needsUpdate = true;
+
};
var scopeTraverse = function ( object3d ) {
+
scope.traverseScene( object3d );
+
};
scope.pivot.traverse( scopeTraverse );
+
};
WWOBJLoader2Example.prototype.alterDouble = function () {
+
var scope = this;
scope.doubleSide = ! scope.doubleSide;
- console.log( scope.doubleSide ? 'Enabling DoubleSide materials' : 'Enabling FrontSide materials');
+ console.log( scope.doubleSide ? 'Enabling DoubleSide materials' : 'Enabling FrontSide materials' );
+
+ scope.traversalFunction = function ( material ) {
- scope.traversalFunction = function ( material ) {
material.side = scope.doubleSide ? THREE.DoubleSide : THREE.FrontSide;
+
};
var scopeTraverse = function ( object3d ) {
+
scope.traverseScene( object3d );
+
};
scope.pivot.traverse( scopeTraverse );
+
};
WWOBJLoader2Example.prototype.traverseScene = function ( object3d ) {
+
if ( object3d.material instanceof THREE.MultiMaterial ) {
var materials = object3d.material.materials;
@@ -416,11 +479,12 @@
this.traversalFunction( object3d.material );
}
+
};
return WWOBJLoader2Example;
- })();
+ } )();
var app = new WWOBJLoader2Example( document.getElementById( 'example' ) );
@@ -438,27 +502,35 @@
var folderOptions = gui.addFolder( 'WWOBJLoader2 Options' );
var controlFlat = folderOptions.add( wwObjLoader2Control, 'flatShading' ).name( 'Flat Shading' );
- controlFlat.onChange( function( value ) {
+ controlFlat.onChange( function ( value ) {
+
console.log( 'Setting flatShading to: ' + value );
app.alterShading();
- });
+
+ } );
var controlDouble = folderOptions.add( wwObjLoader2Control, 'doubleSide' ).name( 'Double Side Materials' );
- controlDouble.onChange( function( value ) {
+ controlDouble.onChange( function ( value ) {
+
console.log( 'Setting doubleSide to: ' + value );
app.alterDouble();
- });
+
+ } );
folderOptions.open();
// init three.js example application
var resizeWindow = function () {
+
app.resizeDisplayGL();
+
};
var render = function () {
+
requestAnimationFrame( render );
app.render();
+
};
window.addEventListener( 'resize', resizeWindow, false );
@@ -469,7 +541,6 @@
// kick render loop
render();
-
// Load a file with OBJLoader.parse synchronously
app.useParseSync();
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_obj2_run_director.html | @@ -89,11 +89,12 @@
'use strict';
- var WWParallels = (function () {
+ var WWParallels = ( function () {
var Validator = THREE.LoaderSupport.Validator;
function WWParallels( elementToBindTo ) {
+
this.renderer = null;
this.canvas = elementToBindTo;
this.aspectRatio = 1;
@@ -126,9 +127,11 @@
this.feedbackArray = null;
this.running = false;
+
}
WWParallels.prototype.initGL = function () {
+
this.renderer = new THREE.WebGLRenderer( {
canvas: this.canvas,
antialias: true,
@@ -146,8 +149,8 @@
var directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
var directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
- directionalLight1.position.set( -100, -50, 100 );
- directionalLight2.position.set( 100, 50, -100 );
+ directionalLight1.position.set( - 100, - 50, 100 );
+ directionalLight2.position.set( 100, 50, - 100 );
this.scene.add( directionalLight1 );
this.scene.add( directionalLight2 );
@@ -158,35 +161,45 @@
this.cube = new THREE.Mesh( geometry, material );
this.cube.position.set( 0, 0, 0 );
this.scene.add( this.cube );
+
};
WWParallels.prototype.resizeDisplayGL = function () {
+
this.controls.handleResize();
this.recalcAspectRatio();
this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
this.updateCamera();
+
};
WWParallels.prototype.recalcAspectRatio = function () {
+
this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
+
};
WWParallels.prototype.resetCamera = function () {
+
this.camera.position.copy( this.cameraDefaults.posCamera );
this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
this.updateCamera();
+
};
WWParallels.prototype.updateCamera = function () {
+
this.camera.aspect = this.aspectRatio;
this.camera.lookAt( this.cameraTarget );
this.camera.updateProjectionMatrix();
+
};
WWParallels.prototype.render = function () {
+
if ( ! this.renderer.autoClear ) this.renderer.clear();
this.controls.update();
@@ -195,18 +208,22 @@
this.cube.rotation.y += 0.05;
this.renderer.render( this.scene, this.camera );
+
};
- WWParallels.prototype._reportProgress = function( content ) {
+ WWParallels.prototype._reportProgress = function ( content ) {
+
var output = content;
if ( Validator.isValid( content ) && Validator.isValid( content.detail ) ) output = content.detail.text;
output = Validator.verifyInput( output, '' );
- if ( this.logging.enabled ) console.info( 'Progress:\n\t' + output.replace(/\<br\>/g, '\n\t' ) );
+ if ( this.logging.enabled ) console.info( 'Progress:\n\t' + output.replace( /\<br\>/g, '\n\t' ) );
document.getElementById( 'feedback' ).innerHTML = output;
+
};
WWParallels.prototype.enqueueAllAssests = function ( maxQueueSize, maxWebWorkers, streamMeshes ) {
+
if ( this.running ) {
return;
@@ -223,7 +240,7 @@
scope.reportDonwload = [];
var i;
- for ( i = 0; i < maxWebWorkers; i++ ) {
+ for ( i = 0; i < maxWebWorkers; i ++ ) {
scope.feedbackArray[ i ] = 'Worker #' + i + ': Awaiting feedback';
scope.reportDonwload[ i ] = true;
@@ -232,6 +249,7 @@
scope._reportProgress( scope.feedbackArray.join( '\<br\>' ) );
var callbackOnLoad = function ( event ) {
+
var instanceNo = event.detail.instanceNo;
scope.reportDonwload[ instanceNo ] = false;
scope.allAssets.push( event.detail.loaderRootNode );
@@ -242,22 +260,28 @@
scope._reportProgress( scope.feedbackArray.join( '\<br\>' ) );
if ( scope.workerDirector.objectsCompleted + 1 === maxQueueSize ) scope.running = false;
+
};
var callbackReportProgress = function ( event ) {
+
var instanceNo = event.detail.instanceNo;
var text = event.detail.text;
if ( scope.reportDonwload[ instanceNo ] ) {
+
var msg = 'Worker #' + instanceNo + ': ' + text;
if ( scope.logging.enabled ) console.info( msg );
scope.feedbackArray[ instanceNo ] = msg;
scope._reportProgress( scope.feedbackArray.join( '\<br\>' ) );
+
}
+
};
var callbackMeshAlter = function ( event, override ) {
+
if ( ! Validator.isValid( override ) ) override = new THREE.LoaderSupport.LoadedMeshUserOverride( false, false );
var material = event.detail.material;
@@ -274,11 +298,14 @@
}
return override;
+
};
var callbackOnLoadMaterials = function ( materials ) {
+
console.log( 'Materials loaded' );
return materials;
+
};
var callbacks = new THREE.LoaderSupport.Callbacks();
@@ -293,7 +320,7 @@
var modelPrepDatas = [];
var prepData;
prepData = new THREE.LoaderSupport.PrepData( 'male02' );
- prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/male02/male02.obj', 'OBJ ') );
+ prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/male02/male02.obj', 'OBJ ' ) );
prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/male02/male02.mtl', 'MTL' ) );
prepData.setLogging( false, false );
modelPrepDatas.push( prepData );
@@ -323,12 +350,12 @@
modelPrepDatas.push( prepData );
var pivot;
- var distributionBase = -500;
+ var distributionBase = - 500;
var distributionMax = 1000;
var modelPrepDataIndex = 0;
var modelPrepData;
var scale;
- for ( i = 0; i < maxQueueSize; i++ ) {
+ for ( i = 0; i < maxQueueSize; i ++ ) {
modelPrepDataIndex = Math.floor( Math.random() * modelPrepDatas.length );
@@ -348,11 +375,14 @@
modelPrepData.streamMeshesTo = pivot;
this.workerDirector.enqueueForRun( modelPrepData );
+
}
this.workerDirector.processQueue();
+
};
WWParallels.prototype.clearAllAssests = function () {
+
var storedObject3d;
for ( var asset in this.allAssets ) {
@@ -377,9 +407,13 @@
if ( materials.hasOwnProperty( name ) ) materials[ name ].dispose();
}
+
}
+
}
+
if ( object3d.hasOwnProperty( 'texture' ) ) object3d.texture.dispose();
+
};
if ( Validator.isValid( storedObject3d ) ) {
@@ -388,19 +422,26 @@
storedObject3d = null;
}
+
}
this.allAssets = [];
+
};
WWParallels.prototype.terminateManager = function () {
+
this.workerDirector.tearDown();
this.running = false;
+
};
WWParallels.prototype.terminateManagerAndClearScene = function () {
+
var scope = this;
- var scopedClearAllAssests = function (){
+ var scopedClearAllAssests = function () {
+
scope.clearAllAssests();
+
};
if ( this.workerDirector.isRunning() ) {
@@ -409,14 +450,16 @@
} else {
scopedClearAllAssests();
+
}
this.running = false;
+
};
return WWParallels;
- })();
+ } )();
var app = new WWParallels( document.getElementById( 'example' ) );
@@ -426,13 +469,19 @@
workerCount: 4,
streamMeshes: true,
run: function () {
+
app.enqueueAllAssests( this.queueLength, this.workerCount, this.streamMeshes );
+
},
terminate: function () {
+
app.terminateManager();
+
},
clearAllAssests: function () {
+
app.terminateManagerAndClearScene();
+
}
};
var gui = new dat.GUI( {
@@ -441,7 +490,7 @@
} );
var menuDiv = document.getElementById( 'dat' );
- menuDiv.appendChild(gui.domElement);
+ menuDiv.appendChild( gui.domElement );
var folderQueue = gui.addFolder( 'Web Worker Director Queue Control' );
folderQueue.add( wwParallelsControl, 'queueLength' ).min( 1 ).max( 1024 ).step( 1 );
folderQueue.add( wwParallelsControl, 'workerCount' ).min( 1 ).max( 16 ).step( 1 );
@@ -454,12 +503,16 @@
folderWWControl.add( wwParallelsControl, 'clearAllAssests' ).name( 'Clear Scene' );
var resizeWindow = function () {
+
app.resizeDisplayGL();
+
};
var render = function () {
+
requestAnimationFrame( render );
app.render();
+
};
window.addEventListener( 'resize', resizeWindow, false ); | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_obj_mtl.html | @@ -86,7 +86,7 @@
};
- var onError = function ( xhr ) { };
+ var onError = function () { };
THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_pcd.html | @@ -30,7 +30,6 @@
span {
display: inline-block;
width: 60px;
- float: left;
text-align: center;
}
@@ -72,8 +71,8 @@
camera = new THREE.PerspectiveCamera( 15, window.innerWidth / window.innerHeight, 0.01, 40 );
camera.position.x = 0.4;
- camera.position.z = -2;
- camera.up.set(0,0,1);
+ camera.position.z = - 2;
+ camera.up.set( 0, 0, 1 );
controls = new THREE.TrackballControls( camera );
@@ -102,7 +101,7 @@
scene.add( mesh );
var center = mesh.geometry.boundingSphere.center;
- controls.target.set( center.x, center.y, center.z);
+ controls.target.set( center.x, center.y, center.z );
controls.update();
} );
@@ -116,7 +115,7 @@
window.addEventListener( 'resize', onWindowResize, false );
- window.addEventListener('keypress', keyboard);
+ window.addEventListener( 'keypress', keyboard );
}
@@ -129,24 +128,24 @@
}
- function keyboard ( ev ) {
+ function keyboard( ev ) {
var ZaghettoMesh = scene.getObjectByName( 'Zaghetto.pcd' );
switch ( ev.key || String.fromCharCode( ev.keyCode || ev.charCode ) ) {
case '+':
- ZaghettoMesh.material.size*=1.2;
+ ZaghettoMesh.material.size *= 1.2;
ZaghettoMesh.material.needsUpdate = true;
break;
case '-':
- ZaghettoMesh.material.size/=1.2;
+ ZaghettoMesh.material.size /= 1.2;
ZaghettoMesh.material.needsUpdate = true;
break;
case 'c':
- ZaghettoMesh.material.color.setHex(Math.random()*0xffffff);
+ ZaghettoMesh.material.color.setHex( Math.random() * 0xffffff );
ZaghettoMesh.material.needsUpdate = true;
break;
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_pdb.html | @@ -121,7 +121,7 @@
scene.add( light );
var light = new THREE.DirectionalLight( 0xffffff, 0.5 );
- light.position.set( -1, -1, 1 );
+ light.position.set( - 1, - 1, 1 );
scene.add( light );
root = new THREE.Group();
@@ -162,11 +162,11 @@
function generateButtonCallback( url ) {
- return function ( event ) {
+ return function () {
loadMolecule( url );
- }
+ };
}
@@ -178,7 +178,7 @@
button.innerHTML = m;
menu.appendChild( button );
- var url = 'models/molecules/' + MOLECULES[ m ];
+ var url = 'models/molecules/' + MOLECULES[ m ];
button.addEventListener( 'click', generateButtonCallback( url ), false );
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_ply.html | @@ -30,7 +30,6 @@
span {
display: inline-block;
width: 60px;
- float: left;
text-align: center;
}
@@ -72,7 +71,7 @@
camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 1, 15 );
camera.position.set( 3, 0.15, 3 );
- cameraTarget = new THREE.Vector3( 0, -0.1, 0 );
+ cameraTarget = new THREE.Vector3( 0, - 0.1, 0 );
scene = new THREE.Scene();
scene.background = new THREE.Color( 0x72645b );
@@ -85,8 +84,8 @@
new THREE.PlaneBufferGeometry( 40, 40 ),
new THREE.MeshPhongMaterial( { color: 0x999999, specular: 0x101010 } )
);
- plane.rotation.x = -Math.PI/2;
- plane.position.y = -0.5;
+ plane.rotation.x = - Math.PI / 2;
+ plane.position.y = - 0.5;
scene.add( plane );
plane.receiveShadow = true;
@@ -103,7 +102,7 @@
var mesh = new THREE.Mesh( geometry, material );
mesh.position.y = - 0.2;
- mesh.position.z = 0.3;
+ mesh.position.z = 0.3;
mesh.rotation.x = - Math.PI / 2;
mesh.scale.multiplyScalar( 0.001 );
@@ -138,7 +137,7 @@
scene.add( new THREE.HemisphereLight( 0x443333, 0x111122 ) );
addShadowedLight( 1, 1, 1, 0xffffff, 1.35 );
- addShadowedLight( 0.5, 1, -1, 0xffaa00, 1 );
+ addShadowedLight( 0.5, 1, - 1, 0xffaa00, 1 );
// renderer
@@ -173,18 +172,18 @@
directionalLight.castShadow = true;
var d = 1;
- directionalLight.shadow.camera.left = -d;
+ directionalLight.shadow.camera.left = - d;
directionalLight.shadow.camera.right = d;
directionalLight.shadow.camera.top = d;
- directionalLight.shadow.camera.bottom = -d;
+ directionalLight.shadow.camera.bottom = - d;
directionalLight.shadow.camera.near = 1;
directionalLight.shadow.camera.far = 4;
directionalLight.shadow.mapSize.width = 1024;
directionalLight.shadow.mapSize.height = 1024;
- directionalLight.shadow.bias = -0.001;
+ directionalLight.shadow.bias = - 0.001;
}
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_prwm.html | @@ -136,7 +136,7 @@
};
- var onError = function ( xhr ) {
+ var onError = function () {
busy = false;
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_sea3d.html | @@ -63,7 +63,7 @@
}
- console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+ console.log( "Visit https://github.com/sunag/sea3d to all codes and builds under development." );
var container, stats;
@@ -81,13 +81,13 @@
loader = new THREE.SEA3D( {
- autoPlay : true, // Auto play animations
- container : scene, // Container to add models
- progressive : true // Progressive download
+ autoPlay: true, // Auto play animations
+ container: scene, // Container to add models
+ progressive: true // Progressive download
} );
- loader.onComplete = function( e ) {
+ loader.onComplete = function () {
// Get camera from SEA3D Studio
// use loader.get... to get others objects
@@ -96,7 +96,7 @@
//camera.position.copy( cam.position );
//camera.rotation.copy( cam.rotation );
- console.log("SEA3D asset loaded!");
+ console.log( "SEA3D asset loaded!" );
};
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_sea3d_hierarchy.html | @@ -48,7 +48,7 @@
<script src="js/loaders/sea3d/SEA3D.js"></script>
<script src="js/loaders/sea3d/SEA3DLZMA.js"></script>
<script src="js/loaders/sea3d/SEA3DLoader.js"></script>
-
+
<script src="js/libs/o3dgc.js"></script>
<script src="js/loaders/sea3d/o3dgc/SEA3DGC.js"></script>
@@ -86,7 +86,7 @@
} );
- loader.onComplete = function ( e ) {
+ loader.onComplete = function () {
// play all animations
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_sea3d_keyframe.html | @@ -83,7 +83,7 @@
} );
- loader.onComplete = function ( e ) {
+ loader.onComplete = function () {
// Get the first camera from 3ds Max
// use loader.get... to get others objects
@@ -211,13 +211,13 @@
}
- function onMouseClick( e ) {
+ function onMouseClick() {
// 0 at 3 demos
switch ( demoAt = ++ demoAt % 4 ) {
- // play all animation to sequence "crash#1"
+ // play all animation to sequence "crash#1"
case 0:
| true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_sea3d_morph.html | @@ -84,7 +84,7 @@
} );
- loader.onComplete = function ( e ) {
+ loader.onComplete = function () {
// Get the first camera from SEA3D Studio
// use loader.get... to get others objects | true |
Other | mrdoob | three.js | 4894f4e44448fdf18ea5f4181e4eba252e276a88.json | Fix linter errors in examples WebGL A-L | examples/webgl_loader_sea3d_physics.html | @@ -91,7 +91,7 @@
} );
- loader.onComplete = function ( e ) {
+ loader.onComplete = function () {
new THREE.OrbitControls( camera );
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.