diff --git a/bin/gltf-pipeline.js b/bin/gltf-pipeline.js index a310a417..99cfa371 100755 --- a/bin/gltf-pipeline.js +++ b/bin/gltf-pipeline.js @@ -171,7 +171,7 @@ if (!defined(outputPath)) { } outputPath = path.join( inputDirectory, - `${inputName}-processed${outputExtension}` + `${inputName}-processed${outputExtension}`, ); } @@ -255,5 +255,5 @@ read(inputPath) }) .catch(function (error) { console.log(error); - process.exit(1); + process.exitCode = 1; }); diff --git a/gulpfile.js b/gulpfile.js index f7da9086..4650b1d3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -47,7 +47,7 @@ async function test() { new JasmineSpecReporter({ displaySuccessfulSpec: !defined(argv.suppressPassed) || !argv.suppressPassed, - }) + }), ); jasmine.exitOnCompletion = false; @@ -83,7 +83,7 @@ function coverage() { " JASMINE_CONFIG_PATH=specs/jasmine.json", { stdio: [process.stdin, process.stdout, process.stderr], - } + }, ); return Promise.resolve(); @@ -172,7 +172,7 @@ function amdify(source, subDependencyMapping) { const mapping = subDependencyMapping[requirePath]; if (!defined(mapping)) { throw new Error( - `Build Failed: Module sub-dependency found for ${requirePath} with no defined mapping behavior.` + `Build Failed: Module sub-dependency found for ${requirePath} with no defined mapping behavior.`, ); } removeRequireMapping.push(requireVariable); @@ -196,7 +196,7 @@ function amdify(source, subDependencyMapping) { if ( Object.prototype.hasOwnProperty.call( subdependencyMapping, - subdependencyVariable + subdependencyVariable, ) ) { requireMapping[subdependencyVariable] = @@ -335,7 +335,7 @@ async function generateThirdParty() { for (const packageName in dependencies) { if (dependencies.hasOwnProperty(packageName)) { const override = thirdPartyExtraJson.find( - (entry) => entry.name === packageName + (entry) => entry.name === packageName, ); thirdPartyJson.push(getLicenseDataFromPackage(packageName, override)); } @@ -355,6 +355,6 @@ async function generateThirdParty() { fsExtra.writeFileSync( "ThirdParty.json", - JSON.stringify(thirdPartyJson, null, 2) + JSON.stringify(thirdPartyJson, null, 2), ); } diff --git a/lib/FileUrl.js b/lib/FileUrl.js index 012ffce8..1aba0d8c 100644 --- a/lib/FileUrl.js +++ b/lib/FileUrl.js @@ -84,7 +84,7 @@ function getPathFromURLWin32(url) { ) { // 5c 5C \ throw new RuntimeError( - "file URL must not include encoded \\ or / characters" + "file URL must not include encoded \\ or / characters", ); } } @@ -124,7 +124,7 @@ function getPathFromURLPosix(url) { const third = pathname.codePointAt(n + 2) | 0x20; if (pathname[n + 1] === "2" && third === 102) { throw new RuntimeError( - "file URL must not include encoded \\ or / characters" + "file URL must not include encoded \\ or / characters", ); } } diff --git a/lib/ForEach.js b/lib/ForEach.js index 44d5c090..567d2a8c 100644 --- a/lib/ForEach.js +++ b/lib/ForEach.js @@ -85,7 +85,7 @@ ForEach.accessorWithSemantic = function (gltf, semantic, handler) { return value; } } - } + }, ); if (defined(valueForEach)) { @@ -107,7 +107,7 @@ ForEach.accessorWithSemantic = function (gltf, semantic, handler) { return value; } } - } + }, ); }); }); @@ -129,7 +129,7 @@ ForEach.accessorContainingVertexAttributeData = function (gltf, handler) { return value; } } - } + }, ); if (defined(valueForEach)) { @@ -148,7 +148,7 @@ ForEach.accessorContainingVertexAttributeData = function (gltf, handler) { return value; } } - } + }, ); }); }); @@ -327,7 +327,7 @@ ForEach.program = function (gltf, handler) { if (usesExtension(gltf, "KHR_techniques_webgl")) { return ForEach.object( gltf.extensions.KHR_techniques_webgl.programs, - handler + handler, ); } @@ -346,7 +346,7 @@ ForEach.shader = function (gltf, handler) { if (usesExtension(gltf, "KHR_techniques_webgl")) { return ForEach.object( gltf.extensions.KHR_techniques_webgl.shaders, - handler + handler, ); } @@ -415,7 +415,7 @@ ForEach.technique = function (gltf, handler) { if (usesExtension(gltf, "KHR_techniques_webgl")) { return ForEach.object( gltf.extensions.KHR_techniques_webgl.techniques, - handler + handler, ); } diff --git a/lib/addDefaults.js b/lib/addDefaults.js index f3fca737..8006d1ea 100644 --- a/lib/addDefaults.js +++ b/lib/addDefaults.js @@ -69,7 +69,7 @@ function addDefaults(gltf) { ForEach.material(gltf, function (material) { const extensions = defaultValue( material.extensions, - defaultValue.EMPTY_OBJECT + defaultValue.EMPTY_OBJECT, ); const materialsCommon = extensions.KHR_materials_common; if (defined(materialsCommon)) { @@ -103,11 +103,11 @@ function addDefaults(gltf) { // These actually exist on the extension object, not the values object despite what's shown in the spec materialsCommon.transparent = defaultValue( materialsCommon.transparent, - false + false, ); materialsCommon.doubleSided = defaultValue( materialsCommon.doubleSided, - false + false, ); return; @@ -115,7 +115,7 @@ function addDefaults(gltf) { material.emissiveFactor = defaultValue( material.emissiveFactor, - [0.0, 0.0, 0.0] + [0.0, 0.0, 0.0], ); material.alphaMode = defaultValue(material.alphaMode, "OPAQUE"); material.doubleSided = defaultValue(material.doubleSided, false); @@ -142,15 +142,15 @@ function addDefaults(gltf) { if (defined(pbrMetallicRoughness)) { pbrMetallicRoughness.baseColorFactor = defaultValue( pbrMetallicRoughness.baseColorFactor, - [1.0, 1.0, 1.0, 1.0] + [1.0, 1.0, 1.0, 1.0], ); pbrMetallicRoughness.metallicFactor = defaultValue( pbrMetallicRoughness.metallicFactor, - 1.0 + 1.0, ); pbrMetallicRoughness.roughnessFactor = defaultValue( pbrMetallicRoughness.roughnessFactor, - 1.0 + 1.0, ); addTextureDefaults(pbrMetallicRoughness.baseColorTexture); addTextureDefaults(pbrMetallicRoughness.metallicRoughnessTexture); @@ -161,15 +161,15 @@ function addDefaults(gltf) { if (defined(pbrSpecularGlossiness)) { pbrSpecularGlossiness.diffuseFactor = defaultValue( pbrSpecularGlossiness.diffuseFactor, - [1.0, 1.0, 1.0, 1.0] + [1.0, 1.0, 1.0, 1.0], ); pbrSpecularGlossiness.specularFactor = defaultValue( pbrSpecularGlossiness.specularFactor, - [1.0, 1.0, 1.0] + [1.0, 1.0, 1.0], ); pbrSpecularGlossiness.glossinessFactor = defaultValue( pbrSpecularGlossiness.glossinessFactor, - 1.0 + 1.0, ); addTextureDefaults(pbrSpecularGlossiness.specularGlossinessTexture); } @@ -199,7 +199,7 @@ function addDefaults(gltf) { [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, - ] + ], ); } }); diff --git a/lib/compressDracoMeshes.js b/lib/compressDracoMeshes.js index 4cade9aa..47040509 100644 --- a/lib/compressDracoMeshes.js +++ b/lib/compressDracoMeshes.js @@ -67,15 +67,15 @@ function compress(gltf, options, encoderModule, decoderModule) { const defaults = compressDracoMeshes.defaults; const compressionLevel = defaultValue( dracoOptions.compressionLevel, - defaults.compressionLevel + defaults.compressionLevel, ); const uncompressedFallback = defaultValue( dracoOptions.uncompressedFallback, - defaults.uncompressedFallback + defaults.uncompressedFallback, ); const unifiedQuantization = defaultValue( dracoOptions.unifiedQuantization, - defaults.unifiedQuantization + defaults.unifiedQuantization, ); const quantizationVolume = dracoOptions.quantizationVolume; const explicitQuantization = @@ -87,14 +87,14 @@ function compress(gltf, options, encoderModule, decoderModule) { if ( Object.prototype.hasOwnProperty.call( quantizationBitsValues, - attributeName + attributeName, ) ) { checkRange( `quantizationBitsValues[${attributeName}]`, quantizationBitsValues[attributeName], 0, - 30 + 30, ); } } @@ -111,8 +111,8 @@ function compress(gltf, options, encoderModule, decoderModule) { Cartesian3.subtract( quantizationVolume.maximum, quantizationVolume.minimum, - new Cartesian3() - ) + new Cartesian3(), + ), ); } else if (unifiedQuantization) { // Collect bounding box from all primitives. Currently works only for vec3 positions (XYZ). @@ -123,7 +123,7 @@ function compress(gltf, options, encoderModule, decoderModule) { const accessor = accessors[accessorId]; if (accessor.type !== "VEC3") { throw new RuntimeError( - "Could not perform unified quantization. Input contains position accessor with an unsupported number of components." + "Could not perform unified quantization. Input contains position accessor with an unsupported number of components.", ); } const accessorMin = accessor.min; @@ -163,7 +163,7 @@ function compress(gltf, options, encoderModule, decoderModule) { // Copy compressed primitive. copyCompressedExtensionToPrimitive( primitive, - hashPrimitives[hashValue] + hashPrimitives[hashValue], ); return; } @@ -176,7 +176,7 @@ function compress(gltf, options, encoderModule, decoderModule) { // First get the faces and add to geometry. const indicesData = readAccessorPacked( gltf, - gltf.accessors[primitive.indices] + gltf.accessors[primitive.indices], ); const indices = new Uint32Array(indicesData); const numberOfFaces = indices.length / 3; @@ -196,7 +196,7 @@ function compress(gltf, options, encoderModule, decoderModule) { getAddAttributeFunctionName(componentType); const data = ComponentDatatype.createTypedArray( componentType, - packed + packed, ); let attributeName = semantic; @@ -223,12 +223,12 @@ function compress(gltf, options, encoderModule, decoderModule) { attributeEnum, numberOfPoints, numberOfComponents, - data + data, ); if (attributeId === -1) { throw new RuntimeError( - `Error: Failed adding attribute ${semantic}` + `Error: Failed adding attribute ${semantic}`, ); } else { attributeToId[semantic] = attributeId; @@ -240,16 +240,16 @@ function compress(gltf, options, encoderModule, decoderModule) { quantizationBitsValues[attributeName], 3, positionOrigin, - positionRange + positionRange, ); } else { encoder.SetAttributeQuantization( attributeEnum, - quantizationBitsValues[attributeName] + quantizationBitsValues[attributeName], ); } } - } + }, ); const encodedDracoDataArray = new encoderModule.DracoInt8Array(); @@ -263,7 +263,7 @@ function compress(gltf, options, encoderModule, decoderModule) { encoder.SetTrackEncodedProperties(true); const encodedLength = encoder.EncodeMeshToDracoBuffer( mesh, - encodedDracoDataArray + encodedDracoDataArray, ); if (encodedLength <= 0) { throw new RuntimeError("Error: Draco encoding failed."); @@ -286,7 +286,7 @@ function compress(gltf, options, encoderModule, decoderModule) { dracoEncodedBuffer, uncompressedFallback, quantizationBitsValues, - decoderModule + decoderModule, ); encoderModule.destroy(encodedDracoDataArray); @@ -344,7 +344,7 @@ function addCompressionExtensionToPrimitive( dracoEncodedBuffer, uncompressedFallback, quantizationBitsValues, - decoderModule + decoderModule, ) { if (!uncompressedFallback) { // Remove properties from accessors. @@ -361,7 +361,7 @@ function addCompressionExtensionToPrimitive( delete attributeAccessor.byteOffset; primitive.attributes[semantic] = addToArray( gltf.accessors, - attributeAccessor + attributeAccessor, ); }); } @@ -380,7 +380,7 @@ function addCompressionExtensionToPrimitive( dracoEncodedBuffer, uncompressedFallback, quantizationBitsValues, - decoderModule + decoderModule, ); } @@ -389,7 +389,7 @@ function copyCompressedExtensionToPrimitive(primitive, compressedPrimitive) { compressedPrimitive, function (accessorId, semantic) { primitive.attributes[semantic] = accessorId; - } + }, ); primitive.indices = compressedPrimitive.indices; @@ -431,7 +431,7 @@ function assignMergedBufferNames(gltf) { assignBufferViewName( gltf, primitive.extensions.KHR_draco_mesh_compression.bufferView, - "draco" + "draco", ); } }); @@ -467,23 +467,23 @@ function getQuantizationBits(dracoOptions) { return { POSITION: defaultValue( dracoOptions.quantizePositionBits, - defaults.quantizePositionBits + defaults.quantizePositionBits, ), NORMAL: defaultValue( dracoOptions.quantizeNormalBits, - defaults.quantizeNormalBits + defaults.quantizeNormalBits, ), TEXCOORD: defaultValue( dracoOptions.quantizeTexcoordBits, - defaults.quantizeTexcoordBits + defaults.quantizeTexcoordBits, ), COLOR: defaultValue( dracoOptions.quantizeColorBits, - defaults.quantizeColorBits + defaults.quantizeColorBits, ), GENERIC: defaultValue( dracoOptions.quantizeGenericBits, - defaults.quantizeGenericBits + defaults.quantizeGenericBits, ), }; } diff --git a/lib/findAccessorMinMax.js b/lib/findAccessorMinMax.js index 174a4320..aaced939 100644 --- a/lib/findAccessorMinMax.js +++ b/lib/findAccessorMinMax.js @@ -58,7 +58,7 @@ function findAccessorMinMax(gltf, accessor) { byteOffset, numberOfComponents, componentTypeByteLength, - components + components, ); for (let j = 0; j < numberOfComponents; j++) { const value = components[j]; diff --git a/lib/getComponentReader.js b/lib/getComponentReader.js index 54769f53..df9d882b 100644 --- a/lib/getComponentReader.js +++ b/lib/getComponentReader.js @@ -21,11 +21,11 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getInt8( - byteOffset + i * componentTypeByteLength + byteOffset + i * componentTypeByteLength, ); } }; @@ -35,11 +35,11 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getUint8( - byteOffset + i * componentTypeByteLength + byteOffset + i * componentTypeByteLength, ); } }; @@ -49,12 +49,12 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getInt16( byteOffset + i * componentTypeByteLength, - true + true, ); } }; @@ -64,12 +64,12 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getUint16( byteOffset + i * componentTypeByteLength, - true + true, ); } }; @@ -79,12 +79,12 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getInt32( byteOffset + i * componentTypeByteLength, - true + true, ); } }; @@ -94,12 +94,12 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getUint32( byteOffset + i * componentTypeByteLength, - true + true, ); } }; @@ -109,12 +109,12 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getFloat32( byteOffset + i * componentTypeByteLength, - true + true, ); } }; @@ -124,12 +124,12 @@ function getComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ) { for (let i = 0; i < numberOfComponents; ++i) { result[i] = dataView.getFloat64( byteOffset + i * componentTypeByteLength, - true + true, ); } }; diff --git a/lib/getStatistics.js b/lib/getStatistics.js index 51684de2..53046823 100644 --- a/lib/getStatistics.js +++ b/lib/getStatistics.js @@ -113,7 +113,7 @@ function getDrawCallStatisticsForNode(gltf, nodeId) { numberOfDrawCalls++; numberOfRenderedPrimitives += getNumberOfRenderedPrimitives( gltf, - primitive + primitive, ); }); } @@ -134,7 +134,7 @@ function getDrawCallStatistics(gltf) { numberOfDrawCalls++; numberOfRenderedPrimitives += getNumberOfRenderedPrimitives( gltf, - primitive + primitive, ); }); }); diff --git a/lib/mergeBuffers.js b/lib/mergeBuffers.js index f3998375..f95123eb 100644 --- a/lib/mergeBuffers.js +++ b/lib/mergeBuffers.js @@ -44,7 +44,7 @@ function mergeBuffers(gltf, defaultName, force) { const extensions = defaultValue( buffer.extensions, - defaultValue.EMPTY_OBJECT + defaultValue.EMPTY_OBJECT, ); const meshoptObject = extensions.EXT_meshopt_compression; if (defined(meshoptObject) && meshoptObject.fallback) { @@ -97,8 +97,8 @@ function mergeBuffers(gltf, defaultName, force) { const sourceBufferViewData = Buffer.from( source.slice( bufferView.byteOffset, - bufferView.byteOffset + bufferView.byteLength - ) + bufferView.byteOffset + bufferView.byteLength, + ), ); const bufferViewPadding = allocateBufferPadding(byteLength); if (defined(bufferViewPadding)) { @@ -163,7 +163,7 @@ function forEachBufferViewLikeObject(gltf, callback) { const extensions = defaultValue( bufferView.extensions, - defaultValue.EMPTY_OBJECT + defaultValue.EMPTY_OBJECT, ); const meshoptObject = extensions.EXT_meshopt_compression; if (defined(meshoptObject)) { diff --git a/lib/moveTechniqueRenderStates.js b/lib/moveTechniqueRenderStates.js index 8c60a5cb..062f6345 100644 --- a/lib/moveTechniqueRenderStates.js +++ b/lib/moveTechniqueRenderStates.js @@ -92,11 +92,11 @@ function moveTechniqueRenderStates(gltf) { blendingForTechnique[techniqueIndex] = { blendEquation: defaultValue( blendFunctions.blendEquationSeparate, - defaultBlendEquation + defaultBlendEquation, ), blendFactors: getSupportedBlendFactors( blendFunctions.blendFuncSeparate, - defaultBlendFactors + defaultBlendFactors, ), }; } diff --git a/lib/moveTechniquesToExtension.js b/lib/moveTechniquesToExtension.js index ca433f5c..db5a1749 100644 --- a/lib/moveTechniquesToExtension.js +++ b/lib/moveTechniquesToExtension.js @@ -50,7 +50,7 @@ function moveTechniquesToExtension(gltf) { technique.attributes[attributeName] = { semantic: parameterLegacy.semantic, }; - } + }, ); ForEach.techniqueUniform( @@ -70,7 +70,7 @@ function moveTechniquesToExtension(gltf) { mappedUniforms[techniqueId] = {}; } mappedUniforms[techniqueId][parameterName] = uniformName; - } + }, ); if (!defined(seenPrograms[techniqueLegacy.program])) { @@ -98,7 +98,7 @@ function moveTechniquesToExtension(gltf) { // Store the index of the new technique to reference instead. updatedTechniqueIndices[techniqueId] = addToArray( extension.techniques, - technique + technique, ); }); diff --git a/lib/parseGlb.js b/lib/parseGlb.js index a4b13a1f..10504867 100644 --- a/lib/parseGlb.js +++ b/lib/parseGlb.js @@ -49,7 +49,7 @@ function readHeader(glb, byteOffset, count) { for (let i = 0; i < count; ++i) { header[i] = dataView.getUint32( glb.byteOffset + byteOffset + i * sizeOfUint32, - true + true, ); } return header; @@ -79,7 +79,7 @@ function parseGlbVersion1(glb, header) { // In some older models, the binary glTF buffer is named KHR_binary_glTF const binaryGltfBuffer = defaultValue( buffers.binary_glTF, - buffers.KHR_binary_glTF + buffers.KHR_binary_glTF, ); if (defined(binaryGltfBuffer)) { binaryGltfBuffer.extras._pipeline.source = binaryBuffer; diff --git a/lib/processGltf.js b/lib/processGltf.js index 55f6ca2a..8966b573 100644 --- a/lib/processGltf.js +++ b/lib/processGltf.js @@ -62,7 +62,7 @@ function processGltf(gltf, options) { const stages = preStages.concat( options.customStages, pipelineStages, - postStages + postStages, ); return Promise.each(stages, function (stage) { diff --git a/lib/readAccessorPacked.js b/lib/readAccessorPacked.js index ed70937c..27251a26 100644 --- a/lib/readAccessorPacked.js +++ b/lib/readAccessorPacked.js @@ -21,7 +21,7 @@ module.exports = readAccessorPacked; function readAccessorPacked(gltf, accessor) { const byteStride = getAccessorByteStride(gltf, accessor); const componentTypeByteLength = ComponentDatatype.getSizeInBytes( - accessor.componentType + accessor.componentType, ); const numberOfComponents = numberOfComponentsForType(accessor.type); const count = accessor.count; @@ -46,7 +46,7 @@ function readAccessorPacked(gltf, accessor) { byteOffset, numberOfComponents, componentTypeByteLength, - components + components, ); for (let j = 0; j < numberOfComponents; ++j) { values[i * numberOfComponents + j] = components[j]; diff --git a/lib/readResources.js b/lib/readResources.js index b5e95086..cf894ed4 100644 --- a/lib/readResources.js +++ b/lib/readResources.js @@ -96,13 +96,13 @@ function readResource(gltf, object, saveResourceId, options) { const khrBinaryGltf = extensions.KHR_binary_glTF; if (defined(khrBinaryGltf)) { return Promise.resolve( - readBufferView(gltf, khrBinaryGltf.bufferView, object, saveResourceId) + readBufferView(gltf, khrBinaryGltf.bufferView, object, saveResourceId), ); } } if (defined(object.bufferView)) { return Promise.resolve( - readBufferView(gltf, object.bufferView, object, saveResourceId) + readBufferView(gltf, object.bufferView, object, saveResourceId), ); } if (!defined(uri)) { @@ -134,13 +134,13 @@ function readFile(object, uri, saveResourceId, options) { try { absoluteUrl = new URL( uri, - hasResourceDirectory ? pathToFileURL(resourceDirectory) : undefined + hasResourceDirectory ? pathToFileURL(resourceDirectory) : undefined, ); } catch (error) { return Promise.reject( new RuntimeError( - "glTF model references separate files but no resourceDirectory is supplied" - ) + "glTF model references separate files but no resourceDirectory is supplied", + ), ); } diff --git a/lib/removeUnusedElements.js b/lib/removeUnusedElements.js index e734d0d6..94767869 100644 --- a/lib/removeUnusedElements.js +++ b/lib/removeUnusedElements.js @@ -93,7 +93,7 @@ Remove.accessor = function (gltf, accessorId) { if (attributeAccessorId > accessorId) { primitive.attributes[semantic]--; } - } + }, ); // Update accessor ids for the targets. @@ -104,7 +104,7 @@ Remove.accessor = function (gltf, accessorId) { if (attributeAccessorId > accessorId) { target[semantic]--; } - } + }, ); }); const indices = primitive.indices; @@ -554,7 +554,7 @@ getListOfElementsIdsInUse.accessor = function (gltf) { const attributeAccessorId = node.extensions.EXT_mesh_gpu_instancing.attributes[key]; usedAccessorIds[attributeAccessorId] = true; - } + }, ); } }); diff --git a/lib/replaceWithDecompressedPrimitive.js b/lib/replaceWithDecompressedPrimitive.js index 40ac9883..213cb20f 100644 --- a/lib/replaceWithDecompressedPrimitive.js +++ b/lib/replaceWithDecompressedPrimitive.js @@ -31,7 +31,7 @@ function replaceWithDecompressedPrimitive( dracoEncodedBuffer, uncompressedFallback, quantizationBitsValues, - decoderModule + decoderModule, ) { let decoder; let dracoGeometry; @@ -45,7 +45,7 @@ function replaceWithDecompressedPrimitive( dracoGeometry = decompressDracoBuffer( decoderModule, decoder, - dracoEncodedBuffer.buffer + dracoEncodedBuffer.buffer, ); const indicesBuffer = getIndicesBuffer( @@ -53,7 +53,7 @@ function replaceWithDecompressedPrimitive( decoderModule, decoder, dracoGeometry, - dracoEncodedBuffer.numberOfFaces + dracoEncodedBuffer.numberOfFaces, ); indicesAccessor.bufferView = addBuffer(gltf, indicesBuffer); @@ -70,20 +70,20 @@ function replaceWithDecompressedPrimitive( if (uncompressedFallback) { const attributeId = decoder.GetAttributeByUniqueId( dracoGeometry, - dracoAttributes[semantic] + dracoAttributes[semantic], ); const bufferObject = getAttributeBuffer( decoderModule, decoder, dracoGeometry, - attributeId + attributeId, ); attributeAccessor.min = bufferObject.minValues; attributeAccessor.max = bufferObject.maxValues; attributeAccessor.bufferView = addBuffer( gltf, - bufferObject.attributeBuffer + bufferObject.attributeBuffer, ); attributeAccessor.byteOffset = 0; } else if ( @@ -93,7 +93,7 @@ function replaceWithDecompressedPrimitive( const minmax = calculateQuantizedMinMax( semantic, attributeAccessor, - quantizationBitsValues + quantizationBitsValues, ); attributeAccessor.min = minmax.min; attributeAccessor.max = minmax.max; @@ -124,7 +124,7 @@ function decompressDracoBuffer(decoderModule, decoder, compressedData) { if (!decodingStatus.ok() || dracoGeometry.ptr === 0) { decoderModule.destroy(decoder); throw new RuntimeError( - `Draco decoding failed: ${decodingStatus.error_msg()}` + `Draco decoding failed: ${decodingStatus.error_msg()}`, ); } @@ -137,7 +137,7 @@ function getIndicesBuffer( decoderModule, decoder, dracoGeometry, - numFaces + numFaces, ) { // Convert indices const numIndices = numFaces * 3; @@ -181,13 +181,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Int8Array(attributeData.size()); @@ -197,13 +197,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeUInt8ForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Uint8Array(attributeData.size()); @@ -213,13 +213,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeInt16ForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Int16Array(attributeData.size()); @@ -229,13 +229,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeUInt16ForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Uint16Array(attributeData.size()); @@ -245,13 +245,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeUInt32ForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Uint32Array(attributeData.size()); @@ -261,13 +261,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeInt32ForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Int32Array(attributeData.size()); @@ -277,13 +277,13 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { !decoder.GetAttributeFloatForAllPoints( dracoGeometry, attribute, - attributeData + attributeData, ) ) { throw new RuntimeError( `Could not get attribute data for id:${attribute .unique_id() - .toString()}` + .toString()}`, ); } attributeArray = new Float32Array(attributeData.size()); @@ -318,7 +318,7 @@ function getAttributeBuffer(decoderModule, decoder, dracoGeometry, attribute) { function calculateQuantizedMinMax( semantic, attributeAccessor, - quantizationBitsValues + quantizationBitsValues, ) { const numberOfComponents = numberOfComponentsForType(attributeAccessor.type); diff --git a/lib/splitPrimitives.js b/lib/splitPrimitives.js index 3d08b291..20c7bcdd 100644 --- a/lib/splitPrimitives.js +++ b/lib/splitPrimitives.js @@ -59,7 +59,7 @@ function splitPrimitives(gltf) { }); const primitivesShared = defaultValue( primitivesWithSharedAttributes[hashAttributes], - [] + [], ); primitivesWithSharedAttributes[hashAttributes] = primitivesShared; primitivesShared.push(primitive); @@ -107,14 +107,14 @@ function copyPrimitive(primitiveToCopy, primitive) { primitiveToCopy, function (accessorId, semantic) { primitive.attributes[semantic] = accessorId; - } + }, ); ForEach.meshPrimitiveTarget(primitiveToCopy, function (target, targetIndex) { ForEach.meshPrimitiveTargetAttribute( target, function (accessorId, semantic) { primitive.targets[targetIndex][semantic] = accessorId; - } + }, ); }); } @@ -144,7 +144,7 @@ function splitPrimitive(gltf, primitive, attributeData, targetData) { semantic, attributeData, mappedIndices, - uniqueIndicesLength + uniqueIndicesLength, ); }); @@ -158,9 +158,9 @@ function splitPrimitive(gltf, primitive, attributeData, targetData) { semantic, targetData[targetIndex], mappedIndices, - uniqueIndicesLength + uniqueIndicesLength, ); - } + }, ); }); } @@ -171,7 +171,7 @@ function createNewAttribute( semantic, attributeData, mappedIndices, - uniqueIndicesLength + uniqueIndicesLength, ) { const accessor = gltf.accessors[accessorId]; const numberOfComponents = numberOfComponentsForType(accessor.type); @@ -199,7 +199,7 @@ function createNewAccessor(gltf, oldAccessor, dataArray) { const numberOfComponents = numberOfComponentsForType(type); const count = dataArray.length / numberOfComponents; const newBuffer = Buffer.from( - ComponentDatatype.createTypedArray(componentType, dataArray).buffer + ComponentDatatype.createTypedArray(componentType, dataArray).buffer, ); const newBufferViewId = addBuffer(gltf, newBuffer); @@ -222,7 +222,7 @@ function readAttributes(gltf, primitive) { ForEach.meshPrimitiveAttribute(primitive, function (accessorId, semantic) { attributeData[semantic] = readAccessorPacked( gltf, - gltf.accessors[accessorId] + gltf.accessors[accessorId], ); }); return attributeData; @@ -238,9 +238,9 @@ function readTargets(gltf, primitive) { function (accessorId, semantic) { attributeData[semantic] = readAccessorPacked( gltf, - gltf.accessors[accessorId] + gltf.accessors[accessorId], ); - } + }, ); }); return targetData; diff --git a/lib/updateAccessorComponentTypes.js b/lib/updateAccessorComponentTypes.js index 0294eb65..60d07d2c 100644 --- a/lib/updateAccessorComponentTypes.js +++ b/lib/updateAccessorComponentTypes.js @@ -47,7 +47,7 @@ function updateAccessorComponentTypes(gltf) { function convertType(gltf, accessor, updatedComponentType) { const typedArray = ComponentDatatype.createTypedArray( updatedComponentType, - readAccessorPacked(gltf, accessor) + readAccessorPacked(gltf, accessor), ); const newBuffer = new Uint8Array(typedArray.buffer); accessor.bufferView = addBuffer(gltf, newBuffer); diff --git a/lib/updateVersion.js b/lib/updateVersion.js index 8cd84c9b..0b7110aa 100644 --- a/lib/updateVersion.js +++ b/lib/updateVersion.js @@ -114,7 +114,7 @@ function setPrimitiveModes(gltf) { const primitive = primitives[i]; const defaultMode = defaultValue( primitive.primitive, - WebGLConstants.TRIANGLES + WebGLConstants.TRIANGLES, ); primitive.mode = defaultValue(primitive.mode, defaultMode); delete primitive.primitive; @@ -186,7 +186,7 @@ function updateAnimations(gltf) { componentType, source.buffer, byteOffset, - length + length, ); for (let j = 0; j < count; j++) { @@ -216,15 +216,15 @@ function removeTechniquePasses(gltf) { const instanceProgram = pass.instanceProgram; technique.attributes = defaultValue( technique.attributes, - instanceProgram.attributes + instanceProgram.attributes, ); technique.program = defaultValue( technique.program, - instanceProgram.program + instanceProgram.program, ); technique.uniforms = defaultValue( technique.uniforms, - instanceProgram.uniforms + instanceProgram.uniforms, ); technique.states = defaultValue(technique.states, pass.states); } @@ -434,7 +434,7 @@ function objectsToArrays(gltf) { primitive, function (accessorId, semantic) { primitive.attributes[semantic] = globalMapping.accessors[accessorId]; - } + }, ); if (defined(primitive.material)) { primitive.material = globalMapping.materials[primitive.material]; @@ -654,7 +654,7 @@ function requireAttributeSetIndex(gltf) { } else if (semantic === "COLOR") { primitive.attributes.COLOR_0 = accessorId; } - } + }, ); delete primitive.attributes.TEXCOORD; delete primitive.attributes.COLOR; @@ -713,7 +713,7 @@ function underscoreApplicationSpecificSemantics(gltf) { mappedSemantics[semantic] = newSemantic; } } - } + }, ); for (const semantic in mappedSemantics) { if (Object.prototype.hasOwnProperty.call(mappedSemantics, semantic)) { @@ -774,7 +774,7 @@ function requireByteLength(gltf) { accessor.byteOffset + accessor.count * accessorByteStride; bufferView.byteLength = Math.max( defaultValue(bufferView.byteLength, 0), - accessorByteEnd + accessorByteEnd, ); } }); @@ -800,7 +800,7 @@ function moveByteStrideToBufferView(gltf) { if (defined(accessor.bufferView)) { bufferViewMap[accessor.bufferView] = defaultValue( bufferViewMap[accessor.bufferView], - [] + [], ); bufferViewMap[accessor.bufferView].push(accessor); } @@ -881,7 +881,7 @@ function isNodeEmpty(node) { Cartesian3.fromArray(node.scale).equals(new Cartesian3(1.0, 1.0, 1.0))) && (!defined(node.rotation) || Cartesian4.fromArray(node.rotation).equals( - new Cartesian4(0.0, 0.0, 0.0, 1.0) + new Cartesian4(0.0, 0.0, 0.0, 1.0), )) && (!defined(node.matrix) || Matrix4.fromColumnMajorArray(node.matrix).equals(Matrix4.IDENTITY)) && @@ -1048,7 +1048,7 @@ function srgbToLinear(srgb) { linear[i] = Math.pow( // eslint-disable-next-line no-loss-of-precision (c + 0.055) * 0.94786729857819905213270142180095, - 2.4 + 2.4, ); } } @@ -1060,11 +1060,11 @@ function convertTechniquesToPbr(gltf, options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); const baseColorTextureNames = defaultValue( options.baseColorTextureNames, - defaultBaseColorTextureNames + defaultBaseColorTextureNames, ); const baseColorFactorNames = defaultValue( options.baseColorFactorNames, - defaultBaseColorFactorNames + defaultBaseColorFactorNames, ); // Future work: convert other values like emissive, specular, etc. Only handling diffuse right now. @@ -1089,7 +1089,7 @@ function convertMaterialsCommonToPbr(gltf) { ForEach.material(gltf, function (material) { const materialsCommon = defaultValue( material.extensions, - defaultValue.EMPTY_OBJECT + defaultValue.EMPTY_OBJECT, ).KHR_materials_common; if (defined(materialsCommon)) { diff --git a/lib/writeResources.js b/lib/writeResources.js index 962df3d5..2cae83e5 100644 --- a/lib/writeResources.js +++ b/lib/writeResources.js @@ -83,7 +83,7 @@ function writeBuffer(gltf, buffer, i, writtenResourceMap, options) { true, ".bin", writtenResourceMap, - options + options, ); } } @@ -108,7 +108,7 @@ function writeImage(gltf, image, i, writtenResourceMap, options) { options.dataUris, extension, writtenResourceMap, - options + options, ); if (defined(image.bufferView)) { // Preserve the image mime type when writing to a buffer view @@ -125,7 +125,7 @@ function writeShader(gltf, shader, i, writtenResourceMap, options) { options.dataUris, ".glsl", writtenResourceMap, - options + options, ); } @@ -137,7 +137,7 @@ function writeResource( dataUris, extension, writtenResourceMap, - options + options, ) { if (separate) { writeFile(gltf, object, index, extension, writtenResourceMap, options); @@ -249,7 +249,7 @@ function writeFile( index, extension, writtenResourceMap, - options + options, ) { delete object.bufferView; diff --git a/package.json b/package.json index a916b3e9..50a1a471 100644 --- a/package.json +++ b/package.json @@ -38,21 +38,28 @@ "cloc": "^2.8.0", "dependency-tree": "^10.0.9", "eslint": "^8.0.1", - "eslint-config-cesium": "^9.0.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-node": "^11.1.0", + "eslint-config-cesium": "^10.0.1", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-n": "^16.1.0", "gulp": "^4.0.2", "husky": "^8.0.3", "jasmine": "^5.0.0", "jasmine-spec-reporter": "^7.0.0", "jsdoc": "^4.0.0", "nyc": "^15.1.0", - "prettier": "2.8.8", - "pretty-quick": "^3.1.1" + "prettier": "3.0.3", + "lint-staged": "^14.0.1" }, + "lint-staged": { + "*.(js|ts)": [ + "eslint --cache --quiet --fix", + "prettier --write" + ], + "*.!(js|ts)": "prettier --write" + }, "scripts": { "prepare": "husky install", - "pre-commit": "eslint && pretty-quick --staged", + "pre-commit": "lint-staged", "jsdoc": "jsdoc ./lib -R ./README.md -d doc", "eslint-fix": "eslint \"./**/*.js\" --fix", "eslint": "eslint \"./**/*.js\" --cache --quiet", @@ -63,7 +70,6 @@ "cloc": "gulp cloc", "prettier": "prettier --write \"**/*\"", "prettier-check": "prettier --check \"**/*\"", - "pretty-quick": "pretty-quick", "build-cesium": "gulp build-cesium", "generate-third-party": "gulp generate-third-party" }, diff --git a/specs/lib/ForEachSpec.js b/specs/lib/ForEachSpec.js index 49a4dd89..df551cc9 100644 --- a/specs/lib/ForEachSpec.js +++ b/specs/lib/ForEachSpec.js @@ -148,7 +148,7 @@ describe("ForEach", () => { if (positionAccessorLength === 5) { return accessorId; } - } + }, ); expect(positionAccessorLength).toBe(5); expect(returnValue).toBe(10); @@ -165,7 +165,7 @@ describe("ForEach", () => { if (vertexAccessorsLength === 10) { return accessorId; } - } + }, ); expect(vertexAccessorsLength).toBe(10); expect(returnValue).toBe(11); @@ -182,7 +182,7 @@ describe("ForEach", () => { if (indicesAccessorsLength === 2) { return accessorId; } - } + }, ); expect(indicesAccessorsLength).toBe(2); expect(returnValue).toBe(1); @@ -247,7 +247,7 @@ describe("ForEach", () => { if (index === 1) { return animation; } - } + }, ); expect(returnValue).toBe(gltfAnimations.animations[1]); @@ -262,7 +262,7 @@ describe("ForEach", () => { if (index === 1) { return channel; } - } + }, ); expect(returnValue).toBe(gltfAnimations.animations[0].channels[1]); @@ -277,7 +277,7 @@ describe("ForEach", () => { if (index === 1) { return sampler; } - } + }, ); expect(returnValue).toBe(gltfAnimations.animations[0].samplers[1]); @@ -461,11 +461,11 @@ describe("ForEach", () => { if (uniformName === "u_specular") { return value; } - } + }, ); expect(count).toBe(3); expect(returnValue).toBe( - material.extensions.KHR_techniques_webgl.values["u_specular"] + material.extensions.KHR_techniques_webgl.values["u_specular"], ); }); @@ -569,10 +569,10 @@ describe("ForEach", () => { if (semantic === "NORMAL") { return accessorId; } - } + }, ); expect(returnValue).toBe( - gltfPrimitives.meshes[0].primitives[0].attributes["NORMAL"] + gltfPrimitives.meshes[0].primitives[0].attributes["NORMAL"], ); }); @@ -610,7 +610,7 @@ describe("ForEach", () => { if (index === 1) { return target; } - } + }, ); expect(returnValue).toBe(gltfTargets.meshes[0].primitives[0].targets[1]); }); @@ -624,10 +624,10 @@ describe("ForEach", () => { if (semantic === "NORMAL") { return accessorId; } - } + }, ); expect(returnValue).toBe( - gltfTargets.meshes[0].primitives[0].targets[0]["NORMAL"] + gltfTargets.meshes[0].primitives[0].targets[0]["NORMAL"], ); }); @@ -710,7 +710,7 @@ describe("ForEach", () => { if (nodesInTree === 5) { return node; } - } + }, ); expect(nodesInTree).toBe(5); @@ -735,7 +735,7 @@ describe("ForEach", () => { if (nodesInScene1 === 1) { return node; } - } + }, ); expect(nodesInScene0).toBe(5); @@ -963,7 +963,7 @@ describe("ForEach", () => { }); expect(count).toBe(2); expect(returnValue).toBe( - gltf.extensions.KHR_techniques_webgl.techniques[1] + gltf.extensions.KHR_techniques_webgl.techniques[1], ); gltf = {}; @@ -1033,7 +1033,7 @@ describe("ForEach", () => { if (count === 3) { return attribute; } - } + }, ); expect(count).toBe(3); @@ -1063,7 +1063,7 @@ describe("ForEach", () => { if (count === 3) { return parameterName; } - } + }, ); expect(count).toBe(3); @@ -1101,7 +1101,7 @@ describe("ForEach", () => { if (count === 3) { return uniform; } - } + }, ); expect(count).toBe(3); @@ -1131,7 +1131,7 @@ describe("ForEach", () => { if (count === 3) { return parameterName; } - } + }, ); expect(count).toBe(3); @@ -1170,7 +1170,7 @@ describe("ForEach", () => { if (count === 3) { return parameter; } - } + }, ); expect(count).toBe(3); diff --git a/specs/lib/addDefaultsSpec.js b/specs/lib/addDefaultsSpec.js index 4568c79f..a76a35eb 100644 --- a/specs/lib/addDefaultsSpec.js +++ b/specs/lib/addDefaultsSpec.js @@ -319,7 +319,7 @@ describe("addDefaults", () => { const staticNode2 = gltfWithDefaults.nodes[2]; expect(gltfWithDefaults.animations[0].samplers[0].interpolation).toBe( - "LINEAR" + "LINEAR", ); expect(animatedNode.matrix).toBeUndefined(); diff --git a/specs/lib/addPipelineExtrasSpec.js b/specs/lib/addPipelineExtrasSpec.js index cc212c75..8e342909 100644 --- a/specs/lib/addPipelineExtrasSpec.js +++ b/specs/lib/addPipelineExtrasSpec.js @@ -21,7 +21,7 @@ describe("addPipelineExtras", () => { }; const gltfWithExtras = addPipelineExtras(gltf); expect( - gltfWithExtras.buffers["sampleBuffer0"].extras._pipeline + gltfWithExtras.buffers["sampleBuffer0"].extras._pipeline, ).toBeDefined(); expect(gltfWithExtras.shaders["sample0VS"].extras._pipeline).toBeDefined(); }); @@ -49,7 +49,8 @@ describe("addPipelineExtras", () => { const gltfWithExtras = addPipelineExtras(gltf); expect(gltfWithExtras.buffers[0].extras._pipeline).toBeDefined(); expect( - gltfWithExtras.extensions.KHR_techniques_webgl.shaders[0].extras._pipeline + gltfWithExtras.extensions.KHR_techniques_webgl.shaders[0].extras + ._pipeline, ).toBeDefined(); }); }); diff --git a/specs/lib/compressDracoMeshesSpec.js b/specs/lib/compressDracoMeshesSpec.js index 82fcf4bd..e0dd1177 100644 --- a/specs/lib/compressDracoMeshesSpec.js +++ b/specs/lib/compressDracoMeshesSpec.js @@ -48,7 +48,7 @@ function getDracoBuffer(gltf) { const source = gltf.buffers[0].extras._pipeline.source; return source.slice( bufferView.byteOffset, - bufferView.byteOffset + bufferView.byteLength + bufferView.byteOffset + bufferView.byteLength, ); } @@ -71,10 +71,10 @@ describe("compressDracoMeshes", () => { gltf.meshes[0].primitives[0].extensions.KHR_draco_mesh_compression; expect(dracoExtension.bufferView).toBeDefined(); expect(gltf.extensionsUsed.indexOf("KHR_draco_mesh_compression") >= 0).toBe( - true + true, ); expect( - gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression") >= 0 + gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression") >= 0, ).toBe(true); const positionAccessor = gltf.accessors[dracoExtension.attributes.POSITION]; @@ -104,10 +104,10 @@ describe("compressDracoMeshes", () => { gltf.meshes[0].primitives[0].extensions.KHR_draco_mesh_compression; expect(dracoExtension.bufferView).toBeDefined(); expect(gltf.extensionsUsed.indexOf("KHR_draco_mesh_compression") >= 0).toBe( - true + true, ); expect( - gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression") >= 0 + gltf.extensionsRequired.indexOf("KHR_draco_mesh_compression") >= 0, ).toBe(true); const positionAccessor = gltf.accessors[dracoExtension.attributes.POSITION]; @@ -154,7 +154,7 @@ describe("compressDracoMeshes", () => { const gltfDefault = await readGltf(multipleBoxesPath); const aabb = new AxisAlignedBoundingBox( new Cartesian3(-10.0, -10.0, -10.0), - new Cartesian3(10.0, 10.0, 10.0) + new Cartesian3(10.0, 10.0, 10.0), ); await compressDracoMeshes(gltfVolume, { dracoOptions: { @@ -209,7 +209,7 @@ describe("compressDracoMeshes", () => { const dracoBufferUncompressed = getDracoBuffer(gltf); const dracoBufferCompressed = getDracoBuffer(gltfOther); expect(dracoBufferCompressed.length).toBeLessThan( - dracoBufferUncompressed.length + dracoBufferUncompressed.length, ); }); @@ -252,14 +252,14 @@ describe("compressDracoMeshes", () => { }); expect(gltf.extensionsUsed.indexOf("KHR_draco_mesh_compression") >= 0).toBe( - true + true, ); expect(gltf.extensionsRequired).toBeUndefined(); expect( - gltfOther.extensionsUsed.indexOf("KHR_draco_mesh_compression") >= 0 + gltfOther.extensionsUsed.indexOf("KHR_draco_mesh_compression") >= 0, ).toBe(true); expect( - gltfOther.extensionsRequired.indexOf("KHR_draco_mesh_compression") >= 0 + gltfOther.extensionsRequired.indexOf("KHR_draco_mesh_compression") >= 0, ).toBe(true); expect(gltf.buffers.length).toBe(6); // draco + image + 4 uncompressed attributes expect(gltfOther.buffers.length).toBe(2); // draco + image @@ -267,23 +267,23 @@ describe("compressDracoMeshes", () => { expect(gltf.buffers[0].extras._pipeline.mergedBufferName).toBeUndefined(); expect(gltf.buffers[1].extras._pipeline.mergedBufferName).toBe("draco"); expect(gltf.buffers[2].extras._pipeline.mergedBufferName).toBe( - "uncompressed" + "uncompressed", ); expect(gltf.buffers[3].extras._pipeline.mergedBufferName).toBe( - "uncompressed" + "uncompressed", ); expect(gltf.buffers[4].extras._pipeline.mergedBufferName).toBe( - "uncompressed" + "uncompressed", ); expect(gltf.buffers[5].extras._pipeline.mergedBufferName).toBe( - "uncompressed" + "uncompressed", ); expect( - gltfOther.buffers[0].extras._pipeline.mergedBufferName + gltfOther.buffers[0].extras._pipeline.mergedBufferName, ).toBeUndefined(); expect( - gltfOther.buffers[1].extras._pipeline.mergedBufferName + gltfOther.buffers[1].extras._pipeline.mergedBufferName, ).toBeUndefined(); }); }); diff --git a/specs/lib/dataUriToBufferSpec.js b/specs/lib/dataUriToBufferSpec.js index c95900c1..0fb16563 100644 --- a/specs/lib/dataUriToBufferSpec.js +++ b/specs/lib/dataUriToBufferSpec.js @@ -5,7 +5,7 @@ describe("dataUriToBuffer", () => { it("converts base64 data uri to buffer", () => { const buffer = Buffer.from([103, 108, 84, 70]); const dataUri = `data:application/octet-stream;base64,${buffer.toString( - "base64" + "base64", )}`; expect(dataUriToBuffer(dataUri)).toEqual(buffer); }); diff --git a/specs/lib/findAccessorMinMaxSpec.js b/specs/lib/findAccessorMinMaxSpec.js index f0039905..72da3175 100644 --- a/specs/lib/findAccessorMinMaxSpec.js +++ b/specs/lib/findAccessorMinMaxSpec.js @@ -38,7 +38,7 @@ function createGltf(elements, byteStride) { const buffer = Buffer.from(new Float32Array(elements).buffer); const byteLength = buffer.length; const dataUri = `data:application/octet-stream;base64,${buffer.toString( - "base64" + "base64", )}`; const gltf = { asset: { diff --git a/specs/lib/getComponentReaderSpec.js b/specs/lib/getComponentReaderSpec.js index 2f1cdd97..cc2a7b45 100644 --- a/specs/lib/getComponentReaderSpec.js +++ b/specs/lib/getComponentReaderSpec.js @@ -7,7 +7,7 @@ const ComponentDatatype = Cesium.ComponentDatatype; function testComponentReader(componentType) { const typedArray = ComponentDatatype.createTypedArray( componentType, - [0, 1, 2] + [0, 1, 2], ); const dataView = new DataView(typedArray.buffer); const componentTypeByteLength = @@ -21,7 +21,7 @@ function testComponentReader(componentType) { byteOffset, numberOfComponents, componentTypeByteLength, - result + result, ); expect(result).toEqual([1, 2]); } diff --git a/specs/lib/getImageExtensionSpec.js b/specs/lib/getImageExtensionSpec.js index 883bded3..9cbe03d2 100644 --- a/specs/lib/getImageExtensionSpec.js +++ b/specs/lib/getImageExtensionSpec.js @@ -6,22 +6,22 @@ const dataUriToBuffer = require("../../lib/dataUriToBuffer"); const getImageExtension = require("../../lib/getImageExtension"); const pngData = dataUriToBuffer( - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gQcDxwOcoRpqQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAFElEQVQI12P8//8/AwwwMSAB3BwAlm4DBdoYksUAAAAASUVORK5CYII=" + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gQcDxwOcoRpqQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAFElEQVQI12P8//8/AwwwMSAB3BwAlm4DBdoYksUAAAAASUVORK5CYII=", ); const gifData = dataUriToBuffer( - "data:image/gif;base64,R0lGODdhBAAEAIAAAP///////ywAAAAABAAEAAACBISPCQUAOw==" + "data:image/gif;base64,R0lGODdhBAAEAIAAAP///////ywAAAAABAAEAAACBISPCQUAOw==", ); const jpgData = dataUriToBuffer( - "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wgARCAAEAAQDAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAACP/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAVSf/8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABBQJ//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAwEBPwF//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAgEBPwF//8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAGPwJ//8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABPyF//9oADAMBAAIAAwAAABCf/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAwEBPxB//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAgEBPxB//8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABPxB//9k=" + "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wgARCAAEAAQDAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAACP/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAVSf/8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABBQJ//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAwEBPwF//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAgEBPwF//8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAGPwJ//8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABPyF//9oADAMBAAIAAwAAABCf/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAwEBPxB//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAgEBPxB//8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABPxB//9k=", ); const bmpData = dataUriToBuffer( - "data:image/bmp;base64,Qk1mAAAAAAAAADYAAAAoAAAABAAAAAQAAAABABgAAAAAADAAAAATCwAAEwsAAAAAAAAAAAAA////////////////////////////////////////////////////////////////" + "data:image/bmp;base64,Qk1mAAAAAAAAADYAAAAoAAAABAAAAAQAAAABABgAAAAAADAAAAATCwAAEwsAAAAAAAAAAAAA////////////////////////////////////////////////////////////////", ); const ktx2Data = dataUriToBuffer( - "data:image/ktx2:base64,q0tUWCAyMLsNChoKAAAAAAEAAABAAAAAQAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAaAAAACwAAACUAAAAdAAAAAgBAAAAAAAA7QEAAAAAAAD1AgAAAAAAAPgAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAIAKACjAQIAAwMAAAAAAAAAAAAAAAA/AAAAAAAAAAAA/////xIAAABLVFhvcmllbnRhdGlvbgByZAAAAFUAAABLVFh3cml0ZXIAdG9rdHggdjQuMC5iZXRhMi41My5nZjgzZDI4NDUuZGlydHkgLyBsaWJrdHggdjQuMC5iZXRhMi41MS5nM2EzMWQ0ZGEuZGlydHkAAAAAHQBfAEcAAAAcAQAAYgAAAAAAAAAAAAAAAAAAAPgAAAAAAAAAAAAAACDAGwABAIBgclixPD5qPIA3EAEAAAJpL1qO+wKACQAAAAAAAAQCEAEAAABACMSHxYxC5qRfZDX/tDYozqTrsZwcLKFPOj8HAAjmamgUQQAA4G9md89jvYMNJJDEE0erNdUVV1pMAlpY6II/hRiwULCxywNMUggi6NVWCjb+FBYpBRcLawsfwLyBDyAEEpo8f13mE8N3+MzWN8aG0uInpReLBNfESNpLUhJjn6b0UYqK6fRJOijLPA7LtfXfpawtHOM5wslUOelTK5qmmCyvsvvBs9vv7W4xDJxWwcfD2u9chVzP234bZjCbzdBt9+rlcHEnF9Uqax51Mg7aopqvbDx89+Bm8yd0dfjyNdzXnWaTS7dwHQMKYiRu4hcUupGEncw9fArUMQahsqgFgqPLjReLeCFOmjpQB/VCqMhnZzzd2+xeHe83j+sRN/Cff4yZ8Q0Cxnpj/0d75e6dw3y0evn6/C0AwdsAARAGgie2geTzWDtGyh9KgpX8WJb+BoILSDZI+sB3AA8ABEAQhjVfWhkigV6/gQJxMCXBAADD9G9HsB/tCHQCO40d4H1eHXIIwiGiqaHGIEjX+AaACQAAAAAAEMRAAPxNflpzjZbtuGAsfCOdQtK6+1SN1+ekY6j7t75MEIfKzChq81nw7nJCXzrVkyZprvXxESlhruXkPYHimL3u9o3k57aC4TXqLc9ZhbxM8VrYjcZ4NtT2+55ZPICCeHUISHGmLmU+/LNbHx0jlpkCmnpHFAZSaHnCJ49gGUlMs7+K4PcBQ9KG618GBGDlxTULGQlp8NdIpU8tdzAFkCSPVU20irfukO/YSpScsCHeCglbH2ljLGR+7McSAoyLd9j0k06gjHZdYiPGpi0n6fX7PCd22juv/0qvP5YIoHnrGZEXMiFaw9chnA2C8POpNi0EQu/lwCZoILII" + "data:image/ktx2:base64,q0tUWCAyMLsNChoKAAAAAAEAAABAAAAAQAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAaAAAACwAAACUAAAAdAAAAAgBAAAAAAAA7QEAAAAAAAD1AgAAAAAAAPgAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAIAKACjAQIAAwMAAAAAAAAAAAAAAAA/AAAAAAAAAAAA/////xIAAABLVFhvcmllbnRhdGlvbgByZAAAAFUAAABLVFh3cml0ZXIAdG9rdHggdjQuMC5iZXRhMi41My5nZjgzZDI4NDUuZGlydHkgLyBsaWJrdHggdjQuMC5iZXRhMi41MS5nM2EzMWQ0ZGEuZGlydHkAAAAAHQBfAEcAAAAcAQAAYgAAAAAAAAAAAAAAAAAAAPgAAAAAAAAAAAAAACDAGwABAIBgclixPD5qPIA3EAEAAAJpL1qO+wKACQAAAAAAAAQCEAEAAABACMSHxYxC5qRfZDX/tDYozqTrsZwcLKFPOj8HAAjmamgUQQAA4G9md89jvYMNJJDEE0erNdUVV1pMAlpY6II/hRiwULCxywNMUggi6NVWCjb+FBYpBRcLawsfwLyBDyAEEpo8f13mE8N3+MzWN8aG0uInpReLBNfESNpLUhJjn6b0UYqK6fRJOijLPA7LtfXfpawtHOM5wslUOelTK5qmmCyvsvvBs9vv7W4xDJxWwcfD2u9chVzP234bZjCbzdBt9+rlcHEnF9Uqax51Mg7aopqvbDx89+Bm8yd0dfjyNdzXnWaTS7dwHQMKYiRu4hcUupGEncw9fArUMQahsqgFgqPLjReLeCFOmjpQB/VCqMhnZzzd2+xeHe83j+sRN/Cff4yZ8Q0Cxnpj/0d75e6dw3y0evn6/C0AwdsAARAGgie2geTzWDtGyh9KgpX8WJb+BoILSDZI+sB3AA8ABEAQhjVfWhkigV6/gQJxMCXBAADD9G9HsB/tCHQCO40d4H1eHXIIwiGiqaHGIEjX+AaACQAAAAAAEMRAAPxNflpzjZbtuGAsfCOdQtK6+1SN1+ekY6j7t75MEIfKzChq81nw7nJCXzrVkyZprvXxESlhruXkPYHimL3u9o3k57aC4TXqLc9ZhbxM8VrYjcZ4NtT2+55ZPICCeHUISHGmLmU+/LNbHx0jlpkCmnpHFAZSaHnCJ49gGUlMs7+K4PcBQ9KG618GBGDlxTULGQlp8NdIpU8tdzAFkCSPVU20irfukO/YSpScsCHeCglbH2ljLGR+7McSAoyLd9j0k06gjHZdYiPGpi0n6fX7PCd22juv/0qvP5YIoHnrGZEXMiFaw9chnA2C8POpNi0EQu/lwCZoILII", ); const basisData = dataUriToBuffer( - "data:image/basis;base64,c0ITAE0AAA9wAAAAqewBAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAQBkAAAAKAAAAQCMAAAABQAAkQAAACsAAABNAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAvAAAAAEAAACPUwHABAAAAAAAAAICmAgAAAAAAEASBAATAAAAAAAAiABgAgAAAAAAABFUVVVVBQDBRAAAAAAAAPJfLQCYAAAAAAAAQAgAEwACAAAAAIgBwAQAAAAAAAACCAAA" + "data:image/basis;base64,c0ITAE0AAA9wAAAAqewBAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAQBkAAAAKAAAAQCMAAAABQAAkQAAACsAAABNAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAvAAAAAEAAACPUwHABAAAAAAAAAICmAgAAAAAAEASBAATAAAAAAAAiABgAgAAAAAAABFUVVVVBQDBRAAAAAAAAPJfLQCYAAAAAAAAQAgAEwACAAAAAIgBwAQAAAAAAAACCAAA", ); const textData = dataUriToBuffer("data:text/plain;charset=utf-8,randomtext"); @@ -43,7 +43,7 @@ describe("getImageExtension", () => { thrownError = e; } expect(thrownError).toEqual( - new RuntimeError("Image data does not have valid header") + new RuntimeError("Image data does not have valid header"), ); }); }); diff --git a/specs/lib/mergeBuffersSpec.js b/specs/lib/mergeBuffersSpec.js index 02f15dc0..f20f4e50 100644 --- a/specs/lib/mergeBuffersSpec.js +++ b/specs/lib/mergeBuffersSpec.js @@ -7,13 +7,13 @@ describe("mergeBuffers", () => { const nan = Number.NaN; const buffer0 = Buffer.from(new Uint8Array([1, 1, 1, 2, 2, nan, 3, 3, 3])); const buffer1 = Buffer.from( - new Uint8Array([4, 4, 4, 4, 4, nan, nan, nan, nan, nan]) + new Uint8Array([4, 4, 4, 4, 4, nan, nan, nan, nan, nan]), ); const dataUri0 = `data:application/octet-stream;base64,${buffer0.toString( - "base64" + "base64", )}`; const dataUri1 = `data:application/octet-stream;base64,${buffer1.toString( - "base64" + "base64", )}`; // All buffer views start on 8-byte alignment, the buffer ends on a 8-byte alignment, and extraneous buffer data is removed @@ -21,7 +21,7 @@ describe("mergeBuffers", () => { new Uint8Array([ 1, 1, 1, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, - ]) + ]), ); const gltf = { @@ -74,35 +74,35 @@ describe("mergeBuffers", () => { const buffer5 = Buffer.from(new Uint8Array([6, 7])); const dataUri0 = `data:application/octet-stream;base64,${buffer0.toString( - "base64" + "base64", )}`; const dataUri1 = `data:application/octet-stream;base64,${buffer1.toString( - "base64" + "base64", )}`; const dataUri2 = `data:application/octet-stream;base64,${buffer2.toString( - "base64" + "base64", )}`; const dataUri3 = `data:application/octet-stream;base64,${buffer3.toString( - "base64" + "base64", )}`; const dataUri4 = `data:application/octet-stream;base64,${buffer4.toString( - "base64" + "base64", )}`; const dataUri5 = `data:application/octet-stream;base64,${buffer5.toString( - "base64" + "base64", )}`; // All buffer views start on 8-byte alignment, the buffer ends on a 8-byte alignment, and extraneous buffer data is removed const expectedBuffer0 = Buffer.from( - new Uint8Array([1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0]) + new Uint8Array([1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0]), ); const expectedBuffer1 = Buffer.from( - new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0]) + new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0]), ); const expectedBuffer2 = Buffer.from( new Uint8Array([ 5, 5, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, - ]) + ]), ); const gltf = { @@ -198,45 +198,45 @@ describe("mergeBuffers", () => { const buffer5 = Buffer.from(new Uint8Array([6, 7])); const dataUri0 = `data:application/octet-stream;base64,${buffer0.toString( - "base64" + "base64", )}`; const dataUri1 = `data:application/octet-stream;base64,${buffer1.toString( - "base64" + "base64", )}`; const dataUri2 = `data:application/octet-stream;base64,${buffer2.toString( - "base64" + "base64", )}`; const dataUri3 = `data:application/octet-stream;base64,${buffer3.toString( - "base64" + "base64", )}`; const dataUri4 = `data:application/octet-stream;base64,${buffer4.toString( - "base64" + "base64", )}`; const dataUri5 = `data:application/octet-stream;base64,${buffer5.toString( - "base64" + "base64", )}`; // All buffer views start on 8-byte alignment, the buffer ends on a 8-byte alignment, and extraneous buffer data is removed const expectedBuffer0 = Buffer.from( - new Uint8Array([1, 1, 1, 1, 0, 0, 0, 0]) + new Uint8Array([1, 1, 1, 1, 0, 0, 0, 0]), ); const expectedBuffer1 = Buffer.from( - new Uint8Array([2, 2, 2, 2, 0, 0, 0, 0]) + new Uint8Array([2, 2, 2, 2, 0, 0, 0, 0]), ); const expectedBuffer2 = Buffer.from( - new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0]) + new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0]), ); const expectedBuffer3 = Buffer.from( - new Uint8Array([5, 5, 0, 0, 0, 0, 0, 0]) + new Uint8Array([5, 5, 0, 0, 0, 0, 0, 0]), ); const expectedBuffer4 = Buffer.from( - new Uint8Array([4, 4, 4, 0, 0, 0, 0, 0]) + new Uint8Array([4, 4, 4, 0, 0, 0, 0, 0]), ); const expectedBuffer5 = Buffer.from( - new Uint8Array([6, 0, 0, 0, 0, 0, 0, 0]) + new Uint8Array([6, 0, 0, 0, 0, 0, 0, 0]), ); const expectedBuffer6 = Buffer.from( - new Uint8Array([7, 0, 0, 0, 0, 0, 0, 0]) + new Uint8Array([7, 0, 0, 0, 0, 0, 0, 0]), ); const gltf = { diff --git a/specs/lib/moveTechniqueRenderStatesSpec.js b/specs/lib/moveTechniqueRenderStatesSpec.js index 9699ddf9..436366a6 100644 --- a/specs/lib/moveTechniqueRenderStatesSpec.js +++ b/specs/lib/moveTechniqueRenderStatesSpec.js @@ -81,10 +81,10 @@ describe("moveTechniqueRenderStates", () => { }; const gltfWithBlendExtension = moveTechniqueRenderStates( - gltfWithBlendFunctions + gltfWithBlendFunctions, ); expect( - gltfWithBlendExtension.extensionsUsed.indexOf("KHR_blend") + gltfWithBlendExtension.extensionsUsed.indexOf("KHR_blend"), ).toBeGreaterThan(-1); expect(gltfWithBlendExtension.extensionsRequired).toBeUndefined(); @@ -124,7 +124,7 @@ describe("moveTechniqueRenderStates", () => { }; let gltfWithBlendExtension = moveTechniqueRenderStates( - gltfWithBlendFunctions + gltfWithBlendFunctions, ); let materialBlending = gltfWithBlendExtension.materials[0].extensions.KHR_blend; @@ -188,7 +188,7 @@ describe("moveTechniqueRenderStates", () => { }; const gltfWithBlendExtension = moveTechniqueRenderStates( - gltfWithBlendFunctions + gltfWithBlendFunctions, ); const materialBlending = diff --git a/specs/lib/moveTechniquesToExtensionSpec.js b/specs/lib/moveTechniquesToExtensionSpec.js index faf131bc..256dbf4c 100644 --- a/specs/lib/moveTechniquesToExtensionSpec.js +++ b/specs/lib/moveTechniquesToExtensionSpec.js @@ -148,10 +148,10 @@ describe("moveTechniquesToExtension", () => { expect(techniques.shaders.length).toBe(3); expect(techniques.shaders[program.fragmentShader].type).toBe( - WebGLConstants.FRAGMENT_SHADER + WebGLConstants.FRAGMENT_SHADER, ); expect(techniques.shaders[program.vertexShader].type).toBe( - WebGLConstants.VERTEX_SHADER + WebGLConstants.VERTEX_SHADER, ); expect(gltfWithTechniquesWebgl.techniques).toBeUndefined(); @@ -178,7 +178,7 @@ describe("moveTechniquesToExtension", () => { expect(technique3.program).toBe(0); expect(technique3.uniforms.u_diffuse.type).toBe(WebGLConstants.FLOAT_VEC4); expect( - gltf.materials[1].extensions.KHR_techniques_webgl.values.u_diffuse + gltf.materials[1].extensions.KHR_techniques_webgl.values.u_diffuse, ).toEqual([0.2, 0.2, 0.2, 1.0]); }); }); diff --git a/specs/lib/parseGlbSpec.js b/specs/lib/parseGlbSpec.js index e04a78cf..a54bff8a 100644 --- a/specs/lib/parseGlbSpec.js +++ b/specs/lib/parseGlbSpec.js @@ -17,7 +17,7 @@ describe("parseGlb", () => { thrownError = e; } expect(thrownError).toEqual( - new RuntimeError("File is not valid binary glTF") + new RuntimeError("File is not valid binary glTF"), ); }); @@ -33,7 +33,7 @@ describe("parseGlb", () => { thrownError = e; } expect(thrownError).toEqual( - new RuntimeError("Binary glTF version is not 1 or 2") + new RuntimeError("Binary glTF version is not 1 or 2"), ); }); @@ -53,7 +53,7 @@ describe("parseGlb", () => { thrownError = e; } expect(thrownError).toEqual( - new RuntimeError("Binary glTF scene format is not JSON") + new RuntimeError("Binary glTF scene format is not JSON"), ); }); @@ -119,13 +119,13 @@ describe("parseGlb", () => { const image = parsedGltf.images.image; expect(image.extensions.KHR_binary_glTF).toBeDefined(); expect(image.extensions.KHR_binary_glTF.bufferView).toBe( - "imageBufferView" + "imageBufferView", ); expect(image.extensions.KHR_binary_glTF.mimeType).toBe("image/jpg"); const shader = parsedGltf.shaders.shader; expect(shader.extensions.KHR_binary_glTF).toBeDefined(); expect(shader.extensions.KHR_binary_glTF.bufferView).toBe( - "shaderBufferView" + "shaderBufferView", ); }); }); diff --git a/specs/lib/processGltfSpec.js b/specs/lib/processGltfSpec.js index ad4cdbee..116efbbd 100644 --- a/specs/lib/processGltfSpec.js +++ b/specs/lib/processGltfSpec.js @@ -44,13 +44,13 @@ describe("processGltf", () => { expect(Object.keys(results.separateResources).length).toBe(4); expect(results.separateResources["Image0001.png"]).toBeDefined(); expect( - results.separateResources["CesiumTexturedBoxTest.bin"] + results.separateResources["CesiumTexturedBoxTest.bin"], ).toBeDefined(); expect( - results.separateResources["CesiumTexturedBoxTest0FS.glsl"] + results.separateResources["CesiumTexturedBoxTest0FS.glsl"], ).toBeDefined(); expect( - results.separateResources["CesiumTexturedBoxTest0VS.glsl"] + results.separateResources["CesiumTexturedBoxTest0VS.glsl"], ).toBeDefined(); }); @@ -106,7 +106,7 @@ describe("processGltf", () => { }; const results = await processGltf(gltf, options); expect(usesExtension(results.gltf, "KHR_draco_mesh_compression")).toBe( - true + true, ); }); diff --git a/specs/lib/readAccessorPackedSpec.js b/specs/lib/readAccessorPackedSpec.js index 760d1c44..2d3bc4ea 100644 --- a/specs/lib/readAccessorPackedSpec.js +++ b/specs/lib/readAccessorPackedSpec.js @@ -38,7 +38,7 @@ function createGltf(elements, byteStride) { const buffer = Buffer.from(new Float32Array(elements).buffer); const byteLength = buffer.length; const dataUri = `data:application/octet-stream;base64,${buffer.toString( - "base64" + "base64", )}`; const gltf = { accessors: [ diff --git a/specs/lib/readResourcesSpec.js b/specs/lib/readResourcesSpec.js index 831d8040..3627a7f8 100644 --- a/specs/lib/readResourcesSpec.js +++ b/specs/lib/readResourcesSpec.js @@ -40,7 +40,7 @@ function checkPaths(object, resourceDirectory) { expect(path.basename(relativePath)).toBe(relativePath); expect(absolutePath).toBe(path.join(resourceDirectory, relativePath)); expect(object.name).toBe( - path.basename(relativePath, path.extname(relativePath)) + path.basename(relativePath, path.extname(relativePath)), ); } @@ -122,8 +122,8 @@ describe("readResources", () => { } expect(thrownError).toEqual( new RuntimeError( - "glTF model references separate files but no resourceDirectory is supplied" - ) + "glTF model references separate files but no resourceDirectory is supplied", + ), ); }); }); diff --git a/specs/lib/removeExtensionSpec.js b/specs/lib/removeExtensionSpec.js index 27fde2a4..46644375 100644 --- a/specs/lib/removeExtensionSpec.js +++ b/specs/lib/removeExtensionSpec.js @@ -112,7 +112,7 @@ describe("removeExtension", () => { expect(gltf.extensionsUsed).toEqual(["KHR_techniques_webgl"]); expect( gltf.extensions.KHR_techniques_webgl.techniques[0].uniforms - .u_modelViewMatrix.semantic + .u_modelViewMatrix.semantic, ).toBe("MODELVIEW"); }); }); diff --git a/specs/lib/removePipelineExtrasSpec.js b/specs/lib/removePipelineExtrasSpec.js index 2026c986..4d561081 100644 --- a/specs/lib/removePipelineExtrasSpec.js +++ b/specs/lib/removePipelineExtrasSpec.js @@ -27,7 +27,7 @@ describe("removePipelineExtras", () => { const gltfWithExtrasRemoved = removePipelineExtras(addPipelineExtras(gltf)); expect(gltfWithExtrasRemoved.buffers[0].extras).toBeUndefined(); expect( - gltfWithExtrasRemoved.extensions.KHR_techniques_webgl.shaders[0].extras + gltfWithExtrasRemoved.extensions.KHR_techniques_webgl.shaders[0].extras, ).toBeUndefined(); }); }); diff --git a/specs/lib/removeUnusedElementsSpec.js b/specs/lib/removeUnusedElementsSpec.js index a6718cf0..ac7d5991 100644 --- a/specs/lib/removeUnusedElementsSpec.js +++ b/specs/lib/removeUnusedElementsSpec.js @@ -457,11 +457,11 @@ describe("removeUnusedElements", () => { expect(Object.keys(gltf)).toContain("extensions"); expect(Object.keys(gltf.extensions)).toContain("KHR_lights_punctual"); expect(Object.keys(gltf.extensions.KHR_lights_punctual)).toContain( - "lights" + "lights", ); expect(gltf.extensions.KHR_lights_punctual.lights.length).toBe( - remaining.lights.length + remaining.lights.length, ); gltf.extensions.KHR_lights_punctual.lights.forEach((element, index) => { @@ -688,7 +688,7 @@ describe("removes unused materials, textures, images, samplers", () => { expect(gltf.materials[0].occlusionTexture.index).toEqual(0); expect(gltf.materials[0].normalTexture.index).toEqual(1); expect( - gltf.materials[1].extensions.KHR_techniques_webgl.values.diffuse.index + gltf.materials[1].extensions.KHR_techniques_webgl.values.diffuse.index, ).toEqual(2); }); @@ -1007,7 +1007,7 @@ describe("removes unused materials, textures, images, samplers", () => { expect(gltf.accessors[3].name).toEqual("indices"); expect( - gltf.meshes[0].primitives[0].extensions.CESIUM_primitive_outline.indices + gltf.meshes[0].primitives[0].extensions.CESIUM_primitive_outline.indices, ).toEqual(1); }); diff --git a/specs/lib/splitPrimitivesSpec.js b/specs/lib/splitPrimitivesSpec.js index 8e9e4ad0..1734dca4 100644 --- a/specs/lib/splitPrimitivesSpec.js +++ b/specs/lib/splitPrimitivesSpec.js @@ -48,7 +48,7 @@ describe("splitPrimitives", () => { ]); const dataUri = `data:application/octet-stream;base64,${source.toString( - "base64" + "base64", )}`; const expectedIndices = [ @@ -210,47 +210,47 @@ describe("splitPrimitives", () => { expect(primitive0).toEqual(primitive2); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.indices]) + readAccessorPacked(gltf, gltf.accessors[primitive0.indices]), ).toEqual(expectedIndices[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.attributes.POSITION]) + readAccessorPacked(gltf, gltf.accessors[primitive0.attributes.POSITION]), ).toEqual(expectedPositions[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.attributes.NORMAL]) + readAccessorPacked(gltf, gltf.accessors[primitive0.attributes.NORMAL]), ).toEqual(expectedNormals[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.targets[0].POSITION]) + readAccessorPacked(gltf, gltf.accessors[primitive0.targets[0].POSITION]), ).toEqual(expectedTarget0Positions[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.targets[0].NORMAL]) + readAccessorPacked(gltf, gltf.accessors[primitive0.targets[0].NORMAL]), ).toEqual(expectedTarget0Normals[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.targets[1].POSITION]) + readAccessorPacked(gltf, gltf.accessors[primitive0.targets[1].POSITION]), ).toEqual(expectedTarget1Positions[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive0.targets[1].NORMAL]) + readAccessorPacked(gltf, gltf.accessors[primitive0.targets[1].NORMAL]), ).toEqual(expectedTarget1Normals[0]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.indices]) + readAccessorPacked(gltf, gltf.accessors[primitive1.indices]), ).toEqual(expectedIndices[1]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.attributes.POSITION]) + readAccessorPacked(gltf, gltf.accessors[primitive1.attributes.POSITION]), ).toEqual(expectedPositions[1]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.attributes.NORMAL]) + readAccessorPacked(gltf, gltf.accessors[primitive1.attributes.NORMAL]), ).toEqual(expectedNormals[1]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.targets[0].POSITION]) + readAccessorPacked(gltf, gltf.accessors[primitive1.targets[0].POSITION]), ).toEqual(expectedTarget0Positions[1]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.targets[0].NORMAL]) + readAccessorPacked(gltf, gltf.accessors[primitive1.targets[0].NORMAL]), ).toEqual(expectedTarget0Normals[1]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.targets[1].POSITION]) + readAccessorPacked(gltf, gltf.accessors[primitive1.targets[1].POSITION]), ).toEqual(expectedTarget1Positions[1]); expect( - readAccessorPacked(gltf, gltf.accessors[primitive1.targets[1].NORMAL]) + readAccessorPacked(gltf, gltf.accessors[primitive1.targets[1].NORMAL]), ).toEqual(expectedTarget1Normals[1]); }); }); diff --git a/specs/lib/updateAccessorComponentTypeSpec.js b/specs/lib/updateAccessorComponentTypeSpec.js index 632afcf6..3fbc78c9 100644 --- a/specs/lib/updateAccessorComponentTypeSpec.js +++ b/specs/lib/updateAccessorComponentTypeSpec.js @@ -20,7 +20,7 @@ describe("updateAccessorComponentTypes", () => { ]); const byteLength = source.length; const dataUri = `data:application/octet-stream;base64,${source.toString( - "base64" + "base64", )}`; buffer = { uri: dataUri, diff --git a/specs/lib/updateVersionSpec.js b/specs/lib/updateVersionSpec.js index 28a61865..4b68e329 100644 --- a/specs/lib/updateVersionSpec.js +++ b/specs/lib/updateVersionSpec.js @@ -81,7 +81,7 @@ describe("updateVersion", () => { axisB.y, axisB.z, angleB, - ]).buffer + ]).buffer, ); const expectedBuffer = Buffer.from( new Float32Array([ @@ -95,11 +95,11 @@ describe("updateVersion", () => { quatB.y, quatB.z, quatB.w, - ]).buffer + ]).buffer, ); const dataUri = `data:application/octet-stream;base64,${originalBuffer.toString( - "base64" + "base64", )}`; const gltf = { @@ -328,7 +328,7 @@ describe("updateVersion", () => { it("updates glTF from 1.0 to 2.0", async () => { const applicationSpecificBuffer = Buffer.from( - new Int16Array([-2, 1, 0, 1, 2, 3]).buffer + new Int16Array([-2, 1, 0, 1, 2, 3]).buffer, ); const positionBuffer = Buffer.from(new Float32Array(9).fill(1.0).buffer); const normalBuffer = Buffer.from(new Float32Array(9).fill(2.0).buffer); @@ -341,7 +341,7 @@ describe("updateVersion", () => { ]); const dataUri = `data:application/octet-stream;base64,${source.toString( - "base64" + "base64", )}`; const gltf = { @@ -677,7 +677,7 @@ describe("updateVersion", () => { // Expect material values to be moved to material KHR_techniques_webgl extension const material = gltf.materials[0]; expect( - material.extensions.KHR_techniques_webgl.values.u_lightAttenuation + material.extensions.KHR_techniques_webgl.values.u_lightAttenuation, ).toEqual(2); // Expect material parameters to be updated @@ -722,7 +722,7 @@ describe("updateVersion", () => { // Underscore added to application specific attributes expect(technique.attributes.a_application.semantic).toEqual( - "_APPLICATIONSPECIFIC" + "_APPLICATIONSPECIFIC", ); expect(primitive.attributes.APPLICATIONSPECIFIC).toBeUndefined(); expect(primitive.attributes._APPLICATIONSPECIFIC).toEqual(0); @@ -748,10 +748,10 @@ describe("updateVersion", () => { ForEach.accessorWithSemantic(gltf, "POSITION", (accessorId) => { const accessor = gltf.accessors[accessorId]; expect(accessor.min.length).toEqual( - numberOfComponentsForType(accessor.type) + numberOfComponentsForType(accessor.type), ); expect(accessor.max.length).toEqual( - numberOfComponentsForType(accessor.type) + numberOfComponentsForType(accessor.type), ); }); @@ -760,10 +760,10 @@ describe("updateVersion", () => { ForEach.animationSampler(animation, (sampler) => { const accessor = gltf.accessors[sampler.input]; expect(accessor.min.length).toEqual( - numberOfComponentsForType(accessor.type) + numberOfComponentsForType(accessor.type), ); expect(accessor.max.length).toEqual( - numberOfComponentsForType(accessor.type) + numberOfComponentsForType(accessor.type), ); }); }); @@ -790,7 +790,7 @@ describe("updateVersion", () => { // glExtensionsUsed removed expect(gltf.glExtensionsUsed).toBeUndefined(); expect( - gltf.extensions.KHR_techniques_webgl.programs[0].glExtensions + gltf.extensions.KHR_techniques_webgl.programs[0].glExtensions, ).toEqual(["OES_element_index_uint"]); }); @@ -806,8 +806,8 @@ describe("updateVersion", () => { CesiumMath.equalsEpsilon( material.pbrMetallicRoughness.baseColorFactor[0], 0.6038273388553378, // Original 0.8 before srgb -> linear conversion - Cesium.Math.EPSILON9 - ) + Cesium.Math.EPSILON9, + ), ).toBe(true); expect(material.pbrMetallicRoughness.baseColorFactor[1]).toBe(0.0); expect(material.pbrMetallicRoughness.baseColorFactor[2]).toBe(0.0); @@ -843,8 +843,8 @@ describe("updateVersion", () => { CesiumMath.equalsEpsilon( material.pbrMetallicRoughness.baseColorFactor[0], 0.6038273388553378, // Original 0.8 before srgb -> linear conversion - Cesium.Math.EPSILON9 - ) + Cesium.Math.EPSILON9, + ), ).toBe(true); expect(material.pbrMetallicRoughness.baseColorFactor[1]).toBe(0.0); expect(material.pbrMetallicRoughness.baseColorFactor[2]).toBe(0.0); diff --git a/specs/lib/writeResourcesSpec.js b/specs/lib/writeResourcesSpec.js index dcce36e3..09cfece2 100644 --- a/specs/lib/writeResourcesSpec.js +++ b/specs/lib/writeResourcesSpec.js @@ -31,10 +31,10 @@ describe("writeResources", () => { gltfWebp = fsExtra.readJsonSync(gltfWebpPath); gltfWebpSeparate = fsExtra.readJsonSync(gltfWebpSeparatePath); gltfSharedImageReferences = fsExtra.readJsonSync( - gltfSharedImageReferencesPath + gltfSharedImageReferencesPath, ); gltfSharedImageReferencesSeparate = fsExtra.readJsonSync( - gltfSharedImageReferencesSeparatePath + gltfSharedImageReferencesSeparatePath, ); await readResources(gltf); @@ -106,7 +106,7 @@ describe("writeResources", () => { expect(gltf.buffers[0].uri).toBe("my-buffer.bin"); expect(gltf.images[0].uri).toBe("my-image.png"); expect(gltf.extensions.KHR_techniques_webgl.shaders[0].uri).toBe( - "my-shader.glsl" + "my-shader.glsl", ); }); @@ -129,7 +129,7 @@ describe("writeResources", () => { expect(gltf.buffers[0].uri).toBe("my-gltf.bin"); expect(gltf.images[0].uri).toBe("my-gltf0.png"); expect(gltf.extensions.KHR_techniques_webgl.shaders[0].uri).toBe( - "my-gltfFS0.glsl" + "my-gltfFS0.glsl", ); }); @@ -192,8 +192,8 @@ describe("writeResources", () => { CesiumMath.equalsEpsilon( buffer.byteLength, originalByteLength + bufferViewByteLength, - 8 - ) + 8, + ), ).toBe(true); }); @@ -209,7 +209,7 @@ describe("writeResources", () => { writeResources(gltfWebpSeparate); // There should be a new bufferView for the WebP, and one for the fallback image. expect(gltfWebpSeparate.bufferViews.length).toBe( - originalBufferViewsLength + 2 + originalBufferViewsLength + 2, ); }); @@ -218,10 +218,10 @@ describe("writeResources", () => { gltfSharedImageReferences.bufferViews.length; writeResources(gltfSharedImageReferences); expect(gltfSharedImageReferences.bufferViews.length).toBe( - originalBufferViewsLength + originalBufferViewsLength, ); expect(gltfSharedImageReferences.images[0].bufferView).toBe( - gltfSharedImageReferences.images[1].bufferView + gltfSharedImageReferences.images[1].bufferView, ); }); @@ -236,17 +236,17 @@ describe("writeResources", () => { writeResources(gltfSharedImageReferences, options); expect(gltfSharedImageReferences.images[0].uri).toBeDefined(); expect(gltfSharedImageReferences.images[0].uri).toBe( - gltfSharedImageReferences.images[1].uri + gltfSharedImageReferences.images[1].uri, ); }); it("does not duplicate multiple references to the same uri", async () => { writeResources(gltfSharedImageReferencesSeparate); expect( - gltfSharedImageReferencesSeparate.images[0].bufferView + gltfSharedImageReferencesSeparate.images[0].bufferView, ).toBeDefined(); expect(gltfSharedImageReferencesSeparate.images[0].bufferView).toBe( - gltfSharedImageReferencesSeparate.images[1].bufferView + gltfSharedImageReferencesSeparate.images[1].bufferView, ); }); @@ -261,7 +261,7 @@ describe("writeResources", () => { writeResources(gltfSharedImageReferencesSeparate, options); expect(gltfSharedImageReferencesSeparate.images[0].uri).toBeDefined(); expect(gltfSharedImageReferencesSeparate.images[0].uri).toBe( - gltfSharedImageReferencesSeparate.images[1].uri + gltfSharedImageReferencesSeparate.images[1].uri, ); }); });