Skip to content

Commit

Permalink
Lint example html (mrdoob#24478)
Browse files Browse the repository at this point in the history
* cleanup example html

* add controls with min/max distance
  • Loading branch information
gero3 authored and snagy committed Sep 21, 2022
1 parent be8ae1a commit ee9ee70
Show file tree
Hide file tree
Showing 45 changed files with 276 additions and 274 deletions.
2 changes: 1 addition & 1 deletion examples/css2d_label.html
Expand Up @@ -66,7 +66,7 @@

}

}
};

const clock = new THREE.Clock();
const textureLoader = new THREE.TextureLoader();
Expand Down
2 changes: 0 additions & 2 deletions examples/index.html
Expand Up @@ -312,10 +312,8 @@ <h1><a href="https://threejs.org">three.js</a></h1>
function filterExample( file, exp, tags ) {

const link = links[ file ];
const name = getName( file );
if ( file in tags ) file += ' ' + tags[ file ].join( ' ' );
const res = file.match( exp );
let text;

if ( res && res.length > 0 ) {

Expand Down
8 changes: 4 additions & 4 deletions examples/jsm/controls/ArcballControls.js
Expand Up @@ -2296,15 +2296,15 @@ class ArcballControls extends EventDispatcher {

//

this._gizmos.traverse( function( object ) {
this._gizmos.traverse( function ( object ) {

if ( object.isLine ) {

object.geometry.dispose();
object.material.dispose();

}

} );

this._gizmos.clear();
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/exporters/GLTFExporter.js
Expand Up @@ -733,15 +733,15 @@ class GLTFWriter {

return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );

}
};

}

return function LinearToLinear( c ) {

return c;

}
};

}

Expand Down
8 changes: 4 additions & 4 deletions examples/jsm/loaders/KTX2Loader.js
Expand Up @@ -688,17 +688,17 @@ async function createDataTexture( container ) {

if ( ! _zstd ) {

_zstd = new Promise(async (resolve) => {
_zstd = new Promise( async ( resolve ) => {

const zstd = new ZSTDDecoder();
await zstd.init();
resolve(zstd);
resolve( zstd );

});
} );

}

levelData = (await _zstd).decode( level.levelData, level.uncompressedByteLength );
levelData = ( await _zstd ).decode( level.levelData, level.uncompressedByteLength );

} else {

Expand Down
3 changes: 1 addition & 2 deletions examples/jsm/loaders/LDrawLoader.js
Expand Up @@ -2413,8 +2413,7 @@ class LDrawLoader extends Loader {

lum = parseInt( token.substring( 9 ) );

}
else {
} else {

lum = parseInt( token );

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/Nodes.js
Expand Up @@ -80,7 +80,7 @@ import JoinNode from './utils/JoinNode.js';
import MatcapUVNode from './utils/MatcapUVNode.js';
import MaxMipLevelNode from './utils/MaxMipLevelNode.js';
import OscNode from './utils/OscNode.js';
import RotateUVNode from './utils/RotateUVNode.js'
import RotateUVNode from './utils/RotateUVNode.js';
import SplitNode from './utils/SplitNode.js';
import SpriteSheetUVNode from './utils/SpriteSheetUVNode.js';
import TimerNode from './utils/TimerNode.js';
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/accessors/ReflectVectorNode.js
Expand Up @@ -14,7 +14,7 @@ class ReflectVectorNode extends Node {

getHash( /*builder*/ ) {

return `reflectVector`;
return 'reflectVector';

}

Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/nodes/display/ColorAdjustmentNode.js
Expand Up @@ -22,16 +22,16 @@ const vibranceNode = new ShaderNode( ( { color, adjustment } ) => {
const average = div( add( color.r, color.g, color.b ), 3.0 );

const mx = max( color.r, max( color.g, color.b ) );
const amt = mul( sub( mx, average ), mul( -3.0, adjustment ) );
const amt = mul( sub( mx, average ), mul( - 3.0, adjustment ) );

return mix( color.rgb, vec3( mx ), amt );

} );

const hueNode = new ShaderNode( ( { color, adjustment } ) => {

const RGBtoYIQ = mat3( 0.299, 0.587, 0.114, 0.595716, -0.274453, -0.321263, 0.211456, -0.522591, 0.311135 );
const YIQtoRGB = mat3( 1.0, 0.9563, 0.6210, 1.0, -0.2721, -0.6474, 1.0, -1.107, 1.7046 );
const RGBtoYIQ = mat3( 0.299, 0.587, 0.114, 0.595716, - 0.274453, - 0.321263, 0.211456, - 0.522591, 0.311135 );
const YIQtoRGB = mat3( 1.0, 0.9563, 0.6210, 1.0, - 0.2721, - 0.6474, 1.0, - 1.107, 1.7046 );

const yiq = mul( RGBtoYIQ, color );

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPURenderer.js
Expand Up @@ -58,7 +58,7 @@ Matrix4.prototype.makeOrthographic = function ( left, right, top, bottom, near,

};

Frustum.prototype.setFromProjectionMatrix = function( m ) {
Frustum.prototype.setFromProjectionMatrix = function ( m ) {

const planes = this.planes;
const me = m.elements;
Expand Down
10 changes: 5 additions & 5 deletions examples/misc_controls_fly.html
Expand Up @@ -93,9 +93,9 @@

specular: 0x333333,
shininess: 15,
map: textureLoader.load( "textures/planets/earth_atmos_2048.jpg" ),
specularMap: textureLoader.load( "textures/planets/earth_specular_2048.jpg" ),
normalMap: textureLoader.load( "textures/planets/earth_normal_2048.jpg" ),
map: textureLoader.load( 'textures/planets/earth_atmos_2048.jpg' ),
specularMap: textureLoader.load( 'textures/planets/earth_specular_2048.jpg' ),
normalMap: textureLoader.load( 'textures/planets/earth_normal_2048.jpg' ),

// y scale is negated to compensate for normal map handedness.
normalScale: new THREE.Vector2( 0.85, - 0.85 )
Expand All @@ -115,7 +115,7 @@

const materialClouds = new THREE.MeshLambertMaterial( {

map: textureLoader.load( "textures/planets/earth_clouds_1024.png" ),
map: textureLoader.load( 'textures/planets/earth_clouds_1024.png' ),
transparent: true

} );
Expand All @@ -129,7 +129,7 @@

const materialMoon = new THREE.MeshPhongMaterial( {

map: textureLoader.load( "textures/planets/moon_1024.jpg" )
map: textureLoader.load( 'textures/planets/moon_1024.jpg' )

} );

Expand Down
1 change: 1 addition & 0 deletions examples/misc_exporter_collada.html
Expand Up @@ -381,6 +381,7 @@
colors.push( r * 128, 0, b * 128 );

}

teapot.geometry.setAttribute( 'color', new THREE.Uint8BufferAttribute( colors, 3, true ) );
teapot.material.vertexColors = true;
teapot.material.needsUpdate = true;
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl2_materials_texture2darray.html
Expand Up @@ -159,7 +159,7 @@

if ( mesh ) {

let value = mesh.material.uniforms[ "depth" ].value;
let value = mesh.material.uniforms[ 'depth' ].value;

value += depthStep;

Expand All @@ -172,7 +172,7 @@

}

mesh.material.uniforms[ "depth" ].value = value;
mesh.material.uniforms[ 'depth' ].value = value;

}

Expand Down
6 changes: 3 additions & 3 deletions examples/webgl_animation_skinning_additive_blending.html
Expand Up @@ -203,10 +203,10 @@
const currentAction = currentSettings ? currentSettings.action : null;
const action = settings ? settings.action : null;

if ( currentAction !== action ) {
if ( currentAction !== action ) {

prepareCrossFade( currentAction, action, 0.35 );

}

};
Expand Down
42 changes: 21 additions & 21 deletions examples/webgl_buffergeometry_compression.html
Expand Up @@ -45,17 +45,17 @@

// options
const data = {
"model": "Icosahedron",
"wireframe": false,
"texture": false,
"detail": 4,
"rotationSpeed": 0.1,
'model': 'Icosahedron',
'wireframe': false,
'texture': false,
'detail': 4,
'rotationSpeed': 0.1,

"QuantizePosEncoding": false,
"NormEncodingMethods": "None", // for normal encodings
"DefaultUVEncoding": false,
'QuantizePosEncoding': false,
'NormEncodingMethods': 'None', // for normal encodings
'DefaultUVEncoding': false,

"totalGPUMemory": "0 bytes"
'totalGPUMemory': '0 bytes'
};
let memoryDisplay;

Expand Down Expand Up @@ -136,13 +136,13 @@

switch ( data.model ) {

case "Icosahedron":
case 'Icosahedron':
return new THREE.IcosahedronGeometry( radius, data.detail );
case "Cylinder":
case 'Cylinder':
return new THREE.CylinderGeometry( radius, radius, radius * 2, data.detail * 6 );
case "Teapot":
case 'Teapot':
return new TeapotGeometry( radius, data.detail * 3, true, true, true, true, true );
case "TorusKnot":
case 'TorusKnot':
return new THREE.TorusKnotGeometry( radius, 10, data.detail * 20, data.detail * 6, 3, 4 );

}
Expand All @@ -169,7 +169,7 @@
}

let folder = gui.addFolder( 'Scene' );
folder.add( data, 'model', [ "Icosahedron", "Cylinder", "TorusKnot", "Teapot" ] ).onChange( generateGeometry );
folder.add( data, 'model', [ 'Icosahedron', 'Cylinder', 'TorusKnot', 'Teapot' ] ).onChange( generateGeometry );
folder.add( data, 'wireframe', false ).onChange( updateLineSegments );
folder.add( data, 'texture', false ).onChange( generateGeometry );
folder.add( data, 'detail', 1, 8, 1 ).onChange( generateGeometry );
Expand All @@ -181,7 +181,7 @@
folder.open();

folder = gui.addFolder( 'Normal Compression' );
folder.add( data, 'NormEncodingMethods', [ "None", "DEFAULT", "OCT1Byte", "OCT2Byte", "ANGLES" ] ).onChange( generateGeometry );
folder.add( data, 'NormEncodingMethods', [ 'None', 'DEFAULT', 'OCT1Byte', 'OCT2Byte', 'ANGLES' ] ).onChange( generateGeometry );
folder.open();

folder = gui.addFolder( 'UV Compression' );
Expand All @@ -190,7 +190,7 @@

folder = gui.addFolder( 'Memory Info' );
folder.open();
memoryDisplay = folder.add( data, 'totalGPUMemory', "0 bytes" );
memoryDisplay = folder.add( data, 'totalGPUMemory', '0 bytes' );
computeGPUMemory( mesh );

//
Expand Down Expand Up @@ -258,19 +258,19 @@
mesh.material = new THREE.MeshPhongMaterial( { color: 0xffffff, emissive: 0x111111 } );
mesh.material.map = data.texture ? texture : null;

if ( data[ "QuantizePosEncoding" ] ) {
if ( data[ 'QuantizePosEncoding' ] ) {

GeometryCompressionUtils.compressPositions( mesh );

}

if ( data[ "NormEncodingMethods" ] !== "None" ) {
if ( data[ 'NormEncodingMethods' ] !== 'None' ) {

GeometryCompressionUtils.compressNormals( mesh, data[ "NormEncodingMethods" ] );
GeometryCompressionUtils.compressNormals( mesh, data[ 'NormEncodingMethods' ] );

}

if ( data[ "DefaultUVEncoding" ] ) {
if ( data[ 'DefaultUVEncoding' ] ) {

GeometryCompressionUtils.compressUvs( mesh );

Expand All @@ -284,7 +284,7 @@
function computeGPUMemory( mesh ) {

// Use BufferGeometryUtils to do memory calculation
memoryDisplay.setValue( BufferGeometryUtils.estimateBytesUsed( mesh.geometry ) + " bytes" );
memoryDisplay.setValue( BufferGeometryUtils.estimateBytesUsed( mesh.geometry ) + ' bytes' );

}

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometry_shapes.html
Expand Up @@ -71,7 +71,7 @@
scene.add( group );

const loader = new THREE.TextureLoader();
const texture = loader.load( "textures/uv_grid_opengl.jpg" );
const texture = loader.load( 'textures/uv_grid_opengl.jpg' );

// it's necessary to apply these settings in order to correctly display the texture on a shape geometry

Expand Down

0 comments on commit ee9ee70

Please sign in to comment.