{ "version": 3, "sources": ["index.js", "lib/glsl-utils/highlight.js", "lib/utils/assert.js", "lib/filters/prop-types.js", "module-injectors.js", "lib/shader-assembly/shader-injections.js", "lib/shader-module/shader-module-instance.js", "lib/shader-assembly/select-shaders.js", "lib/shader-assembly/resolve-modules.js", "lib/shader-assembly/platform-defines.js", "lib/shader-transpiler/transpile-glsl-shader.js", "lib/shader-assembly/shader-hooks.js", "lib/glsl-utils/get-shader-info.js", "lib/shader-assembly/assemble-shaders.js", "lib/shader-assembler.js", "lib/shader-module/normalize-shader-module.js", "lib/glsl-utils/shader-utils.js", "lib/shader-generator/utils/capitalize.js", "lib/shader-generator/glsl/generate-glsl.js", "lib/shader-generator/wgsl/generate-wgsl.js", "lib/shader-generator/generate-shader.js", "lib/wgsl/get-shader-layout-wgsl.js", "modules/math/random/random.js", "modules/math/fp32/fp32.js", "modules/engine/picking/picking.js", "modules/lighting/lights/lighting-uniforms-glsl.js", "modules/lighting/lights/lighting-uniforms.js", "modules/lighting/no-material/dirlight.js", "modules/lighting/phong-material/phong-shaders-glsl.js", "modules/lighting/gouraud-material/gouraud-material.js", "modules/lighting/phong-material/phong-material.js", "modules/lighting/pbr-material/pbr-vertex-glsl.js", "modules/lighting/pbr-material/pbr-fragment-glsl.js", "modules/lighting/pbr-material/pbr-material.js", "modules/postprocessing/image-adjust-filters/brightnesscontrast.js", "modules/postprocessing/image-adjust-filters/denoise.js", "modules/postprocessing/image-adjust-filters/huesaturation.js", "modules/postprocessing/image-adjust-filters/noise.js", "modules/postprocessing/image-adjust-filters/sepia.js", "modules/postprocessing/image-adjust-filters/vibrance.js", "modules/postprocessing/image-adjust-filters/vignette.js", "modules/postprocessing/image-blur-filters/tiltshift.js", "modules/postprocessing/image-blur-filters/triangleblur.js", "modules/postprocessing/image-blur-filters/zoomblur.js", "modules/postprocessing/image-fun-filters/colorhalftone.js", "modules/postprocessing/image-fun-filters/dotscreen.js", "modules/postprocessing/image-fun-filters/edgework.js", "modules/postprocessing/image-fun-filters/hexagonalpixelate.js", "modules/postprocessing/image-fun-filters/ink.js", "modules/postprocessing/image-fun-filters/magnify.js", "modules/postprocessing/image-warp-filters/warp.js", "modules/postprocessing/image-warp-filters/bulgepinch.js", "modules/postprocessing/image-warp-filters/swirl.js", "modules/postprocessing/fxaa/fxaa.js", "modules-webgl1/math/fp64/fp64-utils.js", "modules-webgl1/math/fp64/fp64-arithmetic-glsl.js", "modules-webgl1/math/fp64/fp64-functions-glsl.js", "modules-webgl1/math/fp64/fp64.js", "modules-webgl1/geometry/geometry.js", "modules-webgl1/project/project.js", "modules-webgl1/lighting/lights/lights-glsl.js", "modules-webgl1/lighting/lights/lights.js", "modules-webgl1/lighting/dirlight/dirlight.js", "modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.js", "modules-webgl1/lighting/phong-lighting/phong-lighting.js", "modules-webgl1/lighting/pbr/pbr-vertex-glsl.js", "modules-webgl1/lighting/pbr/pbr-fragment-glsl.js", "modules-webgl1/lighting/pbr/pbr.js"], "sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// shadertools exports\n/**\n * Marks GLSL shaders for syntax highlighting: glsl`...`\n * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal\n */\nexport { glsl } from \"./lib/glsl-utils/highlight.js\";\nexport { ShaderModuleInstance } from \"./lib/shader-module/shader-module-instance.js\";\n// ShaderAssembler\nexport { ShaderAssembler } from \"./lib/shader-assembler.js\";\nexport { normalizeShaderModule } from \"./lib/shader-module/normalize-shader-module.js\";\n// SHADER HELPERS\n// Shader source introspection\nexport { getShaderInfo } from \"./lib/glsl-utils/get-shader-info.js\";\nexport { getQualifierDetails, getPassthroughFS, typeToChannelSuffix, typeToChannelCount, convertToVec4 } from \"./lib/glsl-utils/shader-utils.js\";\nexport { generateShaderForModule } from \"./lib/shader-generator/generate-shader.js\";\nexport { capitalize } from \"./lib/shader-generator/utils/capitalize.js\";\n// TEST EXPORTS - Do not use in production applications\nexport { assembleShaderPairGLSL } from \"./lib/shader-assembly/assemble-shaders.js\";\nexport { ShaderModuleInstance as _ShaderModuleInstance } from \"./lib/shader-module/shader-module-instance.js\";\nexport { combineInjects } from \"./lib/shader-assembly/shader-injections.js\";\nexport { resolveModules as _resolveModules } from \"./lib/shader-assembly/resolve-modules.js\";\nexport { getDependencyGraph as _getDependencyGraph } from \"./lib/shader-assembly/resolve-modules.js\";\n// EXPERIMENTAL WGSL\nexport { getShaderLayoutFromWGSL } from \"./lib/wgsl/get-shader-layout-wgsl.js\";\n// SHADER MODULES - WEBGL1 VERSION\n// utils\n// math libraries\nexport { random } from \"./modules/math/random/random.js\";\nexport { fp32 } from \"./modules/math/fp32/fp32.js\";\nexport { picking } from \"./modules/engine/picking/picking.js\";\nexport { lighting } from \"./modules/lighting/lights/lighting-uniforms.js\";\nexport { dirlight } from \"./modules/lighting/no-material/dirlight.js\";\nexport { gouraudMaterial } from \"./modules/lighting/gouraud-material/gouraud-material.js\";\nexport { phongMaterial } from \"./modules/lighting/phong-material/phong-material.js\";\n// export type {PBRMaterialSettings, PBRMaterialUniforms} from './modules/lighting/pbr-material/pbr';\nexport { pbrMaterial } from \"./modules/lighting/pbr-material/pbr-material.js\";\nexport { brightnessContrast } from \"./modules/postprocessing/image-adjust-filters/brightnesscontrast.js\";\nexport { denoise } from \"./modules/postprocessing/image-adjust-filters/denoise.js\";\nexport { hueSaturation } from \"./modules/postprocessing/image-adjust-filters/huesaturation.js\";\nexport { noise } from \"./modules/postprocessing/image-adjust-filters/noise.js\";\nexport { sepia } from \"./modules/postprocessing/image-adjust-filters/sepia.js\";\nexport { vibrance } from \"./modules/postprocessing/image-adjust-filters/vibrance.js\";\nexport { vignette } from \"./modules/postprocessing/image-adjust-filters/vignette.js\";\nexport { tiltShift } from \"./modules/postprocessing/image-blur-filters/tiltshift.js\";\nexport { triangleBlur } from \"./modules/postprocessing/image-blur-filters/triangleblur.js\";\nexport { zoomBlur } from \"./modules/postprocessing/image-blur-filters/zoomblur.js\";\nexport { colorHalftone } from \"./modules/postprocessing/image-fun-filters/colorhalftone.js\";\nexport { dotScreen } from \"./modules/postprocessing/image-fun-filters/dotscreen.js\";\nexport { edgeWork } from \"./modules/postprocessing/image-fun-filters/edgework.js\";\nexport { hexagonalPixelate } from \"./modules/postprocessing/image-fun-filters/hexagonalpixelate.js\";\nexport { ink } from \"./modules/postprocessing/image-fun-filters/ink.js\";\nexport { magnify } from \"./modules/postprocessing/image-fun-filters/magnify.js\";\nexport { bulgePinch } from \"./modules/postprocessing/image-warp-filters/bulgepinch.js\";\nexport { swirl } from \"./modules/postprocessing/image-warp-filters/swirl.js\";\n// Postprocessing modules\n// export type {FXAAProps} from './modules/postprocessing/fxaa/fxaa';\nexport { fxaa } from \"./modules/postprocessing/fxaa/fxaa.js\";\nexport { warp as _warp } from \"./modules/postprocessing/image-warp-filters/warp.js\";\n// DEPRECATED - v8 legacy shader modules (non-uniform buffer)\n// math libraries\nexport { fp64, fp64arithmetic } from \"./modules-webgl1/math/fp64/fp64.js\";\n// projection and lighting\nexport { geometry as geometry1 } from \"./modules-webgl1/geometry/geometry.js\";\nexport { project as project1 } from \"./modules-webgl1/project/project.js\";\nexport { lights as lights1 } from \"./modules-webgl1/lighting/lights/lights.js\";\nexport { dirlight as dirlight1 } from \"./modules-webgl1/lighting/dirlight/dirlight.js\";\nexport { gouraudLighting, phongLighting } from \"./modules-webgl1/lighting/phong-lighting/phong-lighting.js\";\nexport { pbr } from \"./modules-webgl1/lighting/pbr/pbr.js\";\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// SHADER HELPERS\n/**\n * Marks GLSL shaders for syntax highlighting: glsl`...`\n * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal\n */\nexport const glsl = (x) => `${x}`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Recommendation is to ignore message but current test suite checks agains the\n// message so keep it for now.\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'shadertools: assertion failed.');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { assert } from \"../utils/assert.js\";\n/** Minimal validators for number and array types */\nconst DEFAULT_PROP_VALIDATORS = {\n number: {\n type: 'number',\n validate(value, propType) {\n return (Number.isFinite(value) &&\n typeof propType === 'object' &&\n (propType.max === undefined || value <= propType.max) &&\n (propType.min === undefined || value >= propType.min));\n }\n },\n array: {\n type: 'array',\n validate(value, propType) {\n return Array.isArray(value) || ArrayBuffer.isView(value);\n }\n }\n};\n/**\n * Parse a list of property types into property definitions that can be used to validate\n * values passed in by applications.\n * @param propTypes\n * @returns\n */\nexport function makePropValidators(propTypes) {\n const propValidators = {};\n for (const [name, propType] of Object.entries(propTypes)) {\n propValidators[name] = makePropValidator(propType);\n }\n return propValidators;\n}\n/**\n * Validate a map of user supplied properties against a map of validators\n * Inject default values when user doesn't supply a property\n * @param properties\n * @param propValidators\n * @returns\n */\nexport function getValidatedProperties(properties, propValidators, errorMessage) {\n const validated = {};\n for (const [key, propsValidator] of Object.entries(propValidators)) {\n if (properties && key in properties && !propsValidator.private) {\n if (propsValidator.validate) {\n assert(propsValidator.validate(properties[key], propsValidator), `${errorMessage}: invalid ${key}`);\n }\n validated[key] = properties[key];\n }\n else {\n // property not supplied - use default value\n validated[key] = propsValidator.value;\n }\n }\n // TODO - warn for unused properties that don't match a validator?\n return validated;\n}\n/**\n * Creates a property validator for a prop type. Either contains:\n * - a valid prop type object ({type, ...})\n * - or just a default value, in which case type and name inference is used\n */\nfunction makePropValidator(propType) {\n let type = getTypeOf(propType);\n if (type !== 'object') {\n return { value: propType, ...DEFAULT_PROP_VALIDATORS[type], type };\n }\n // Special handling for objects\n if (typeof propType === 'object') {\n if (!propType) {\n return { type: 'object', value: null };\n }\n if (propType.type !== undefined) {\n return { ...propType, ...DEFAULT_PROP_VALIDATORS[propType.type], type: propType.type };\n }\n // If no type and value this object is likely the value\n if (propType.value === undefined) {\n return { type: 'object', value: propType };\n }\n type = getTypeOf(propType.value);\n return { ...propType, ...DEFAULT_PROP_VALIDATORS[type], type };\n }\n throw new Error('props');\n}\n/**\n * \"improved\" version of javascript typeof that can distinguish arrays and null values\n */\nfunction getTypeOf(value) {\n if (Array.isArray(value) || ArrayBuffer.isView(value)) {\n return 'array';\n }\n return typeof value;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"./lib/glsl-utils/highlight.js\";\nexport const MODULE_INJECTORS_VS = `\\\n#ifdef MODULE_LOGDEPTH\nlogdepth_adjustPosition(gl_Position);\n#endif\n`;\nexport const MODULE_INJECTORS_FS = `\\\n#ifdef MODULE_MATERIAL\ngl_FragColor = material_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_LIGHTING\ngl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_FOG\ngl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_PICKING\ngl_FragColor = picking_filterHighlightColor(gl_FragColor);\ngl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n#ifdef MODULE_LOGDEPTH\nlogdepth_setFragDepth();\n#endif\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { MODULE_INJECTORS_VS, MODULE_INJECTORS_FS } from \"../../module-injectors.js\";\nimport { assert } from \"../utils/assert.js\";\n// TODO - experimental\nconst MODULE_INJECTORS = {\n vertex: MODULE_INJECTORS_VS,\n fragment: MODULE_INJECTORS_FS\n};\nconst REGEX_START_OF_MAIN = /void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/; // Beginning of main\nconst REGEX_END_OF_MAIN = /}\\n?[^{}]*$/; // End of main, assumes main is last function\nconst fragments = [];\nexport const DECLARATION_INJECT_MARKER = '__LUMA_INJECT_DECLARATIONS__';\n/**\n *\n */\nexport function normalizeInjections(injections) {\n const result = { vertex: {}, fragment: {} };\n for (const hook in injections) {\n let injection = injections[hook];\n const stage = getHookStage(hook);\n if (typeof injection === 'string') {\n injection = {\n order: 0,\n injection\n };\n }\n result[stage][hook] = injection;\n }\n return result;\n}\nfunction getHookStage(hook) {\n const type = hook.slice(0, 2);\n switch (type) {\n case 'vs':\n return 'vertex';\n case 'fs':\n return 'fragment';\n default:\n throw new Error(type);\n }\n}\n/**\n// A minimal shader injection/templating system.\n// RFC: https://github.com/visgl/luma.gl/blob/7.0-release/dev-docs/RFCs/v6.0/shader-injection-rfc.md\n * @param source\n * @param type\n * @param inject\n * @param injectStandardStubs\n * @returns\n */\n// eslint-disable-next-line complexity\nexport function injectShader(source, stage, inject, injectStandardStubs = false) {\n const isVertex = stage === 'vertex';\n for (const key in inject) {\n const fragmentData = inject[key];\n fragmentData.sort((a, b) => a.order - b.order);\n fragments.length = fragmentData.length;\n for (let i = 0, len = fragmentData.length; i < len; ++i) {\n fragments[i] = fragmentData[i].injection;\n }\n const fragmentString = `${fragments.join('\\n')}\\n`;\n switch (key) {\n // declarations are injected before the main function\n case 'vs:#decl':\n if (isVertex) {\n source = source.replace(DECLARATION_INJECT_MARKER, fragmentString);\n }\n break;\n // inject code at the beginning of the main function\n case 'vs:#main-start':\n if (isVertex) {\n source = source.replace(REGEX_START_OF_MAIN, (match) => match + fragmentString);\n }\n break;\n // inject code at the end of main function\n case 'vs:#main-end':\n if (isVertex) {\n source = source.replace(REGEX_END_OF_MAIN, (match) => fragmentString + match);\n }\n break;\n // declarations are injected before the main function\n case 'fs:#decl':\n if (!isVertex) {\n source = source.replace(DECLARATION_INJECT_MARKER, fragmentString);\n }\n break;\n // inject code at the beginning of the main function\n case 'fs:#main-start':\n if (!isVertex) {\n source = source.replace(REGEX_START_OF_MAIN, (match) => match + fragmentString);\n }\n break;\n // inject code at the end of main function\n case 'fs:#main-end':\n if (!isVertex) {\n source = source.replace(REGEX_END_OF_MAIN, (match) => fragmentString + match);\n }\n break;\n default:\n // TODO(Tarek): I think this usage should be deprecated.\n // inject code after key, leaving key in place\n source = source.replace(key, (match) => match + fragmentString);\n }\n }\n // Remove if it hasn't already been replaced\n source = source.replace(DECLARATION_INJECT_MARKER, '');\n // Finally, if requested, insert an automatic module injector chunk\n if (injectStandardStubs) {\n source = source.replace(/\\}\\s*$/, (match) => match + MODULE_INJECTORS[stage]);\n }\n return source;\n}\n// Takes an array of inject objects and combines them into one\nexport function combineInjects(injects) {\n const result = {};\n assert(Array.isArray(injects) && injects.length > 1);\n injects.forEach(inject => {\n for (const key in inject) {\n result[key] = result[key] ? `${result[key]}\\n${inject[key]}` : inject[key];\n }\n });\n return result;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { assert } from \"../utils/assert.js\";\nimport { makePropValidators, getValidatedProperties } from \"../filters/prop-types.js\";\nimport { normalizeInjections } from \"../shader-assembly/shader-injections.js\";\nlet index = 1;\n/** An initialized ShaderModule, ready to use with `assembleShaders()` */\nexport class ShaderModuleInstance {\n name;\n vs;\n fs;\n getModuleUniforms;\n dependencies;\n deprecations;\n defines;\n injections;\n uniforms = {};\n uniformTypes = {};\n static instantiateModules(modules) {\n return modules.map((module) => {\n if (module instanceof ShaderModuleInstance) {\n return module;\n }\n assert(typeof module !== 'string', `Shader module use by name is deprecated. Import shader module '${JSON.stringify(module)}' and use it directly.`);\n if (!module.name) {\n // eslint-disable-next-line no-console\n console.warn('shader module has no name');\n module.name = `shader-module-${index++}`;\n }\n const moduleObject = new ShaderModuleInstance(module);\n moduleObject.dependencies = ShaderModuleInstance.instantiateModules(module.dependencies || []);\n return moduleObject;\n });\n }\n constructor(props) {\n const { name, vs, fs, dependencies = [], uniformTypes = {}, uniformPropTypes = {}, getUniforms, deprecations = [], defines = {}, inject = {} } = props;\n assert(typeof name === 'string');\n this.name = name;\n this.vs = vs;\n this.fs = fs;\n this.getModuleUniforms = getUniforms;\n this.dependencies = ShaderModuleInstance.instantiateModules(dependencies);\n this.deprecations = this._parseDeprecationDefinitions(deprecations);\n this.defines = defines;\n this.injections = normalizeInjections(inject);\n this.uniformTypes = uniformTypes;\n if (uniformPropTypes) {\n this.uniforms = makePropValidators(uniformPropTypes);\n }\n }\n // Extracts the source code chunk for the specified shader type from the named shader module\n getModuleSource(stage) {\n let moduleSource;\n switch (stage) {\n case 'vertex':\n moduleSource = this.vs || '';\n break;\n case 'fragment':\n moduleSource = this.fs || '';\n break;\n default:\n assert(false);\n }\n const moduleName = this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_');\n return `\\\n// ----- MODULE ${this.name} ---------------\n\n#define MODULE_${moduleName}\n${moduleSource}\\\n\n\n`;\n }\n getUniforms(userProps, uniforms) {\n if (this.getModuleUniforms) {\n return this.getModuleUniforms(userProps, uniforms);\n }\n // Build uniforms from the uniforms array\n return getValidatedProperties(userProps, this.uniforms, this.name);\n }\n getDefines() {\n return this.defines;\n }\n // Warn about deprecated uniforms or functions\n checkDeprecations(shaderSource, log) {\n this.deprecations.forEach(def => {\n if (def.regex?.test(shaderSource)) {\n if (def.deprecated) {\n log.deprecated(def.old, def.new)();\n }\n else {\n log.removed(def.old, def.new)();\n }\n }\n });\n }\n _parseDeprecationDefinitions(deprecations) {\n deprecations.forEach(def => {\n switch (def.type) {\n case 'function':\n def.regex = new RegExp(`\\\\b${def.old}\\\\(`);\n break;\n default:\n def.regex = new RegExp(`${def.type} ${def.old};`);\n }\n });\n return deprecations;\n }\n _defaultGetUniforms(opts = {}) {\n const uniforms = {};\n const propTypes = this.uniforms;\n for (const key in propTypes) {\n const propDef = propTypes[key];\n if (key in opts && !propDef.private) {\n if (propDef.validate) {\n assert(propDef.validate(opts[key], propDef), `${this.name}: invalid ${key}`);\n }\n uniforms[key] = opts[key];\n }\n else {\n uniforms[key] = propDef.value;\n }\n }\n return uniforms;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Shader selection\n * @param device\n * @param props\n * @returns\n */\nexport function selectShaders(props) {\n // If we have a source field, we have a single unified shader source\n if (props.source && props.platformInfo.type === 'webgpu') {\n const propsCopy = { ...props, vs: undefined, fs: undefined };\n return propsCopy;\n }\n if (!props.vs) {\n throw new Error('no vertex shader');\n }\n // Resolve WGSL vs GLSL\n const vs = getShaderSource(props.platformInfo, props.vs);\n let fs;\n if (props.fs) {\n fs = getShaderSource(props.platformInfo, props.fs);\n }\n return { ...props, vs, fs };\n}\n/** Create a shader from the different overloads */\nfunction getShaderSource(platformInfo, shader) {\n // TODO - detect WGSL/GLSL and throw an error if not supported\n if (typeof shader === 'string') {\n return shader;\n }\n switch (platformInfo.type) {\n case 'webgpu':\n if (shader?.wgsl) {\n return shader.wgsl;\n }\n throw new Error('WebGPU does not support GLSL shaders');\n default:\n if (shader?.glsl) {\n return shader.glsl;\n }\n throw new Error('WebGL does not support WGSL shaders');\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { ShaderModuleInstance } from \"../shader-module/shader-module-instance.js\";\n/**\n * Instantiate shader modules and esolve any dependencies\n */\nexport function resolveModules(modules) {\n const instances = ShaderModuleInstance.instantiateModules(modules);\n return getShaderDependencies(instances);\n}\n/**\n * Takes a list of shader module names and returns a new list of\n * shader module names that includes all dependencies, sorted so\n * that modules that are dependencies of other modules come first.\n *\n * If the shader glsl code from the returned modules is concatenated\n * in the reverse order, it is guaranteed that all functions be resolved and\n * that all function and variable definitions come before use.\n *\n * @param modules - Array of modules (inline modules or module names)\n * @return - Array of modules\n */\nfunction getShaderDependencies(modules) {\n const moduleMap = {};\n const moduleDepth = {};\n getDependencyGraph({ modules, level: 0, moduleMap, moduleDepth });\n // Return a reverse sort so that dependencies come before the modules that use them\n return Object.keys(moduleDepth)\n .sort((a, b) => moduleDepth[b] - moduleDepth[a])\n .map(name => moduleMap[name]);\n}\n/**\n * Recursively checks module dependencies to calculate dependency level of each module.\n *\n * @param options.modules - Array of modules\n * @param options.level - Current level\n * @param options.moduleMap -\n * @param options.moduleDepth - Current level\n * @return - Map of module name to its level\n */\n// Adds another level of dependencies to the result map\nexport function getDependencyGraph(options) {\n const { modules, level, moduleMap, moduleDepth } = options;\n if (level >= 5) {\n throw new Error('Possible loop in shader dependency graph');\n }\n // Update level on all current modules\n for (const module of modules) {\n moduleMap[module.name] = module;\n if (moduleDepth[module.name] === undefined || moduleDepth[module.name] < level) {\n moduleDepth[module.name] = level;\n }\n }\n // Recurse\n for (const module of modules) {\n if (module.dependencies) {\n getDependencyGraph({ modules: module.dependencies, level: level + 1, moduleMap, moduleDepth });\n }\n }\n}\nexport const TEST_EXPORTS = {\n getShaderDependencies,\n getDependencyGraph\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../glsl-utils/highlight.js\";\n/** Adds defines to help identify GPU architecture / platform */\nexport function getPlatformShaderDefines(platformInfo) {\n switch (platformInfo?.gpu.toLowerCase()) {\n case 'apple':\n return `\\\n#define APPLE_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`;\n case 'nvidia':\n return `\\\n#define NVIDIA_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n`;\n case 'intel':\n return `\\\n#define INTEL_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`;\n case 'amd':\n // AMD Does not eliminate fp64 code\n return `\\\n#define AMD_GPU\n`;\n default:\n // We don't know what GPU it is, could be that the GPU driver or\n // browser is not implementing UNMASKED_RENDERER constant and not\n // reporting a correct name\n return `\\\n#define DEFAULT_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// TRANSPILATION TABLES\n/**\n * Transpiles GLSL 3.00 shader source code to target GLSL version (3.00 or 1.00)\n *\n * @note We always run transpiler even if same version e.g. 3.00 => 3.00\n * @note For texture sampling transpilation, apps need to use non-standard texture* calls in GLSL 3.00 source\n * RFC: https://github.com/visgl/luma.gl/blob/7.0-release/dev-docs/RFCs/v6.0/portable-glsl-300-rfc.md\n */\nexport function transpileGLSLShader(source, stage) {\n const sourceGLSLVersion = Number(source.match(/^#version[ \\t]+(\\d+)/m)?.[1] || 100);\n if (sourceGLSLVersion !== 300) {\n // TODO - we splurge on a longer error message to help deck.gl custom layer developers\n throw new Error('luma.gl v9 only supports GLSL 3.00 shader sources');\n }\n switch (stage) {\n case 'vertex':\n source = convertShader(source, ES300_VERTEX_REPLACEMENTS);\n return source;\n case 'fragment':\n source = convertShader(source, ES300_FRAGMENT_REPLACEMENTS);\n return source;\n default:\n // Unknown shader stage\n throw new Error(stage);\n }\n}\n/** Simple regex replacements for GLSL ES 1.00 syntax that has changed in GLSL ES 3.00 */\nconst ES300_REPLACEMENTS = [\n // Fix poorly formatted version directive\n [/^(#version[ \\t]+(100|300[ \\t]+es))?[ \\t]*\\n/, '#version 300 es\\n'],\n // The individual `texture...()` functions were replaced with `texture()` overloads\n [/\\btexture(2D|2DProj|Cube)Lod(EXT)?\\(/g, 'textureLod('],\n [/\\btexture(2D|2DProj|Cube)(EXT)?\\(/g, 'texture(']\n];\nconst ES300_VERTEX_REPLACEMENTS = [\n ...ES300_REPLACEMENTS,\n // `attribute` keyword replaced with `in`\n [makeVariableTextRegExp('attribute'), 'in $1'],\n // `varying` keyword replaced with `out`\n [makeVariableTextRegExp('varying'), 'out $1']\n];\n/** Simple regex replacements for GLSL ES 1.00 syntax that has changed in GLSL ES 3.00 */\nconst ES300_FRAGMENT_REPLACEMENTS = [\n ...ES300_REPLACEMENTS,\n // `varying` keyword replaced with `in`\n [makeVariableTextRegExp('varying'), 'in $1']\n];\nfunction convertShader(source, replacements) {\n for (const [pattern, replacement] of replacements) {\n source = source.replace(pattern, replacement);\n }\n return source;\n}\n/**\n * Creates a regexp that tests for a specific variable type\n * @example\n * should match:\n * in float weight;\n * out vec4 positions[2];\n * should not match:\n * void f(out float a, in float b) {}\n */\nfunction makeVariableTextRegExp(qualifier) {\n return new RegExp(`\\\\b${qualifier}[ \\\\t]+(\\\\w+[ \\\\t]+\\\\w+(\\\\[\\\\w+\\\\])?;)`, 'g');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Generate hook source code */\nexport function getShaderHooks(hookFunctions, hookInjections) {\n let result = '';\n for (const hookName in hookFunctions) {\n const hookFunction = hookFunctions[hookName];\n result += `void ${hookFunction.signature} {\\n`;\n if (hookFunction.header) {\n result += ` ${hookFunction.header}`;\n }\n if (hookInjections[hookName]) {\n const injections = hookInjections[hookName];\n injections.sort((a, b) => a.order - b.order);\n for (const injection of injections) {\n result += ` ${injection.injection}\\n`;\n }\n }\n if (hookFunction.footer) {\n result += ` ${hookFunction.footer}`;\n }\n result += '}\\n';\n }\n return result;\n}\n/**\n * Parse string based hook functions\n * And split per shader\n */\nexport function normalizeShaderHooks(hookFunctions) {\n const result = { vertex: {}, fragment: {} };\n for (const hookFunction of hookFunctions) {\n let opts;\n let hook;\n if (typeof hookFunction !== 'string') {\n opts = hookFunction;\n hook = opts.hook;\n }\n else {\n opts = {};\n hook = hookFunction;\n }\n hook = hook.trim();\n const [shaderStage, signature] = hook.split(':');\n const name = hook.replace(/\\(.+/, '');\n const normalizedHook = Object.assign(opts, { signature });\n switch (shaderStage) {\n case 'vs':\n result.vertex[name] = normalizedHook;\n break;\n case 'fs':\n result.fragment[name] = normalizedHook;\n break;\n default:\n throw new Error(shaderStage);\n }\n }\n return result;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/** Extracts information from shader source code */\nexport function getShaderInfo(source, defaultName) {\n return {\n name: getShaderName(source, defaultName),\n language: 'glsl',\n version: getShaderVersion(source)\n };\n}\n/** Extracts GLSLIFY style naming of shaders: `#define SHADER_NAME ...` */\nfunction getShaderName(shader, defaultName = 'unnamed') {\n const SHADER_NAME_REGEXP = /#define[^\\S\\r\\n]*SHADER_NAME[^\\S\\r\\n]*([A-Za-z0-9_-]+)\\s*/;\n const match = SHADER_NAME_REGEXP.exec(shader);\n return match ? match[1] : defaultName;\n}\n/** returns GLSL shader version of given shader string */\nfunction getShaderVersion(source) {\n let version = 100;\n const words = source.match(/[^\\s]+/g);\n if (words && words.length >= 2 && words[0] === '#version') {\n const parsedVersion = parseInt(words[1], 10);\n if (Number.isFinite(parsedVersion)) {\n version = parsedVersion;\n }\n }\n if (version !== 100 && version !== 300) {\n throw new Error(`Invalid GLSL version ${version}`);\n }\n return version;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../glsl-utils/highlight.js\";\nimport { resolveModules } from \"./resolve-modules.js\";\nimport { getPlatformShaderDefines } from \"./platform-defines.js\";\nimport { injectShader, DECLARATION_INJECT_MARKER } from \"./shader-injections.js\";\nimport { transpileGLSLShader } from \"../shader-transpiler/transpile-glsl-shader.js\";\nimport { normalizeShaderHooks, getShaderHooks } from \"./shader-hooks.js\";\nimport { assert } from \"../utils/assert.js\";\nimport { getShaderInfo } from \"../glsl-utils/get-shader-info.js\";\nconst INJECT_SHADER_DECLARATIONS = `\\n\\n${DECLARATION_INJECT_MARKER}\\n`;\n/**\n * Precision prologue to inject before functions are injected in shader\n * TODO - extract any existing prologue in the fragment source and move it up...\n */\nconst FRAGMENT_SHADER_PROLOGUE = `\\\nprecision highp float;\n`;\n/**\n * Inject a list of shader modules into a single shader source for WGSL\n */\nexport function assembleShaderWGSL(options) {\n const modules = resolveModules(options.modules || []);\n return {\n source: assembleWGSLShader(options.platformInfo, {\n ...options,\n source: options.source,\n stage: 'vertex',\n modules\n }),\n getUniforms: assembleGetUniforms(modules)\n };\n}\n/**\n * Injects dependent shader module sources into pair of main vertex/fragment shader sources for WGSL\n */\nexport function assembleShaderPairWGSL(options) {\n const modules = resolveModules(options.modules || []);\n return {\n vs: assembleWGSLShader(options.platformInfo, {\n ...options,\n source: options.vs,\n stage: 'vertex',\n modules\n }),\n fs: assembleWGSLShader(options.platformInfo, {\n ...options,\n source: options.fs,\n stage: 'fragment',\n modules\n }),\n getUniforms: assembleGetUniforms(modules)\n };\n}\n/**\n * Injects dependent shader module sources into pair of main vertex/fragment shader sources for GLSL\n */\nexport function assembleShaderPairGLSL(options) {\n const { vs, fs } = options;\n const modules = resolveModules(options.modules || []);\n return {\n vs: assembleGLSLShader(options.platformInfo, {\n ...options,\n source: vs,\n stage: 'vertex',\n modules\n }),\n fs: assembleGLSLShader(options.platformInfo, {\n ...options,\n source: fs,\n stage: 'fragment',\n modules\n }),\n getUniforms: assembleGetUniforms(modules)\n };\n}\n/**\n * Pulls together complete source code for either a vertex or a fragment shader\n * adding prologues, requested module chunks, and any final injections.\n * @param gl\n * @param options\n * @returns\n */\nexport function assembleWGSLShader(platformInfo, options) {\n const { \n // id,\n source, stage, modules, \n // defines = {},\n hookFunctions = [], inject = {}, log } = options;\n assert(typeof source === 'string', 'shader source must be a string');\n // const isVertex = type === 'vs';\n // const sourceLines = source.split('\\n');\n const coreSource = source;\n // Combine Module and Application Defines\n // const allDefines = {};\n // modules.forEach(module => {\n // Object.assign(allDefines, module.getDefines());\n // });\n // Object.assign(allDefines, defines);\n // Add platform defines (use these to work around platform-specific bugs and limitations)\n // Add common defines (GLSL version compatibility, feature detection)\n // Add precision declaration for fragment shaders\n let assembledSource = '';\n // prologue\n // ? `\\\n // ${getShaderNameDefine({id, source, type})}\n // ${getShaderType(type)}\n // ${getPlatformShaderDefines(platformInfo)}\n // ${getApplicationDefines(allDefines)}\n // ${isVertex ? '' : FRAGMENT_SHADER_PROLOGUE}\n // `\n // `;\n const hookFunctionMap = normalizeShaderHooks(hookFunctions);\n // Add source of dependent modules in resolved order\n const hookInjections = {};\n const declInjections = {};\n const mainInjections = {};\n for (const key in inject) {\n const injection = typeof inject[key] === 'string' ? { injection: inject[key], order: 0 } : inject[key];\n const match = /^(v|f)s:(#)?([\\w-]+)$/.exec(key);\n if (match) {\n const hash = match[2];\n const name = match[3];\n if (hash) {\n if (name === 'decl') {\n declInjections[key] = [injection];\n }\n else {\n mainInjections[key] = [injection];\n }\n }\n else {\n hookInjections[key] = [injection];\n }\n }\n else {\n // Regex injection\n mainInjections[key] = [injection];\n }\n }\n // TODO - hack until shadertool modules support WebGPU\n const modulesToInject = platformInfo.type !== 'webgpu' ? modules : [];\n for (const module of modulesToInject) {\n if (log) {\n module.checkDeprecations(coreSource, log);\n }\n const moduleSource = module.getModuleSource(stage, 'wgsl');\n // Add the module source, and a #define that declares it presence\n assembledSource += moduleSource;\n const injections = module.injections[stage];\n for (const key in injections) {\n const match = /^(v|f)s:#([\\w-]+)$/.exec(key);\n if (match) {\n const name = match[2];\n const injectionType = name === 'decl' ? declInjections : mainInjections;\n injectionType[key] = injectionType[key] || [];\n injectionType[key].push(injections[key]);\n }\n else {\n hookInjections[key] = hookInjections[key] || [];\n hookInjections[key].push(injections[key]);\n }\n }\n }\n // For injectShader\n assembledSource += INJECT_SHADER_DECLARATIONS;\n assembledSource = injectShader(assembledSource, stage, declInjections);\n assembledSource += getShaderHooks(hookFunctionMap[stage], hookInjections);\n // Add the version directive and actual source of this shader\n assembledSource += coreSource;\n // Apply any requested shader injections\n assembledSource = injectShader(assembledSource, stage, mainInjections);\n return assembledSource;\n}\n/**\n * Pulls together complete source code for either a vertex or a fragment shader\n * adding prologues, requested module chunks, and any final injections.\n * @param gl\n * @param options\n * @returns\n */\nfunction assembleGLSLShader(platformInfo, options) {\n const { id, source, stage, language = 'glsl', modules, defines = {}, hookFunctions = [], inject = {}, prologue = true, log } = options;\n assert(typeof source === 'string', 'shader source must be a string');\n const sourceVersion = language === 'glsl' ? getShaderInfo(source).version : -1;\n const targetVersion = platformInfo.shaderLanguageVersion;\n const sourceVersionDirective = sourceVersion === 100 ? '#version 100' : '#version 300 es';\n const sourceLines = source.split('\\n');\n // TODO : keep all pre-processor statements at the beginning of the shader.\n const coreSource = sourceLines.slice(1).join('\\n');\n // Combine Module and Application Defines\n const allDefines = {};\n modules.forEach(module => {\n Object.assign(allDefines, module.getDefines());\n });\n Object.assign(allDefines, defines);\n // Add platform defines (use these to work around platform-specific bugs and limitations)\n // Add common defines (GLSL version compatibility, feature detection)\n // Add precision declaration for fragment shaders\n let assembledSource = '';\n switch (language) {\n case 'wgsl':\n break;\n case 'glsl':\n assembledSource = prologue\n ? `\\\n${sourceVersionDirective}\n\n// ----- PROLOGUE -------------------------\n${getShaderNameDefine({ id, source, stage })}\n${`#define SHADER_TYPE_${stage.toUpperCase()}`}\n${getPlatformShaderDefines(platformInfo)}\n${stage === 'fragment' ? FRAGMENT_SHADER_PROLOGUE : ''}\n\n// ----- APPLICATION DEFINES -------------------------\n\n${getApplicationDefines(allDefines)}\n\n`\n : `${sourceVersionDirective}\n`;\n break;\n }\n const hookFunctionMap = normalizeShaderHooks(hookFunctions);\n // Add source of dependent modules in resolved order\n const hookInjections = {};\n const declInjections = {};\n const mainInjections = {};\n for (const key in inject) {\n // @ts-expect-error\n const injection = typeof inject[key] === 'string' ? { injection: inject[key], order: 0 } : inject[key];\n const match = /^(v|f)s:(#)?([\\w-]+)$/.exec(key);\n if (match) {\n const hash = match[2];\n const name = match[3];\n if (hash) {\n if (name === 'decl') {\n declInjections[key] = [injection];\n }\n else {\n mainInjections[key] = [injection];\n }\n }\n else {\n hookInjections[key] = [injection];\n }\n }\n else {\n // Regex injection\n mainInjections[key] = [injection];\n }\n }\n for (const module of modules) {\n if (log) {\n module.checkDeprecations(coreSource, log);\n }\n const moduleSource = module.getModuleSource(stage);\n // Add the module source, and a #define that declares it presence\n assembledSource += moduleSource;\n const injections = module.injections[stage];\n for (const key in injections) {\n const match = /^(v|f)s:#([\\w-]+)$/.exec(key);\n if (match) {\n const name = match[2];\n const injectionType = name === 'decl' ? declInjections : mainInjections;\n injectionType[key] = injectionType[key] || [];\n injectionType[key].push(injections[key]);\n }\n else {\n hookInjections[key] = hookInjections[key] || [];\n hookInjections[key].push(injections[key]);\n }\n }\n }\n assembledSource += '// ----- MAIN SHADER SOURCE -------------------------';\n // For injectShader\n assembledSource += INJECT_SHADER_DECLARATIONS;\n assembledSource = injectShader(assembledSource, stage, declInjections);\n assembledSource += getShaderHooks(hookFunctionMap[stage], hookInjections);\n // Add the version directive and actual source of this shader\n assembledSource += coreSource;\n // Apply any requested shader injections\n assembledSource = injectShader(assembledSource, stage, mainInjections);\n if (language === 'glsl' && sourceVersion !== targetVersion) {\n assembledSource = transpileGLSLShader(assembledSource, stage);\n }\n return assembledSource.trim();\n}\n/**\n * Returns a combined `getUniforms` covering the options for all the modules,\n * the created function will pass on options to the inidividual `getUniforms`\n * function of each shader module and combine the results into one object that\n * can be passed to setUniforms.\n * @param modules\n * @returns\n */\nexport function assembleGetUniforms(modules) {\n return function getUniforms(opts) {\n const uniforms = {};\n for (const module of modules) {\n // `modules` is already sorted by dependency level. This guarantees that\n // modules have access to the uniforms that are generated by their dependencies.\n const moduleUniforms = module.getUniforms(opts, uniforms);\n Object.assign(uniforms, moduleUniforms);\n }\n return uniforms;\n };\n}\n/**\n * Generate \"glslify-compatible\" SHADER_NAME defines\n * These are understood by the GLSL error parsing function\n * If id is provided and no SHADER_NAME constant is present in source, create one\n */\nfunction getShaderNameDefine(options) {\n const { id, source, stage } = options;\n const injectShaderName = id && source.indexOf('SHADER_NAME') === -1;\n return injectShaderName\n ? `\n#define SHADER_NAME ${id}_${stage}\n\n`\n : '';\n}\n/** Generates application defines from an object of key value pairs */\nfunction getApplicationDefines(defines = {}) {\n let sourceText = '';\n for (const define in defines) {\n const value = defines[define];\n if (value || Number.isFinite(value)) {\n sourceText += `#define ${define.toUpperCase()} ${defines[define]}\\n`;\n }\n }\n return sourceText;\n}\n/*\nfunction getHookFunctions(\n hookFunctions: Record,\n hookInjections: Record\n): string {\n let result = '';\n for (const hookName in hookFunctions) {\n const hookFunction = hookFunctions[hookName];\n result += `void ${hookFunction.signature} {\\n`;\n if (hookFunction.header) {\n result += ` ${hookFunction.header}`;\n }\n if (hookInjections[hookName]) {\n const injections = hookInjections[hookName];\n injections.sort((a: {order: number}, b: {order: number}): number => a.order - b.order);\n for (const injection of injections) {\n result += ` ${injection.injection}\\n`;\n }\n }\n if (hookFunction.footer) {\n result += ` ${hookFunction.footer}`;\n }\n result += '}\\n';\n }\n\n return result;\n}\n\nfunction normalizeHookFunctions(hookFunctions: (string | HookFunction)[]): {\n vs: Record;\n fs: Record;\n} {\n const result: {vs: Record; fs: Record} = {\n vs: {},\n fs: {}\n };\n\n hookFunctions.forEach((hookFunction: string | HookFunction) => {\n let opts: HookFunction;\n let hook: string;\n if (typeof hookFunction !== 'string') {\n opts = hookFunction;\n hook = opts.hook;\n } else {\n opts = {} as HookFunction;\n hook = hookFunction;\n }\n hook = hook.trim();\n const [stage, signature] = hook.split(':');\n const name = hook.replace(/\\(.+/, '');\n if (stage !== 'vs' && stage !== 'fs') {\n throw new Error(stage);\n }\n result[stage][name] = Object.assign(opts, {signature});\n });\n\n return result;\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { ShaderModuleInstance } from \"./shader-module/shader-module-instance.js\";\nimport { selectShaders } from \"./shader-assembly/select-shaders.js\";\nimport { assembleShaderWGSL, assembleShaderPairWGSL, assembleShaderPairGLSL } from \"./shader-assembly/assemble-shaders.js\";\n/**\n * A stateful version of `assembleShaders` that can be used to assemble shaders.\n * Supports setting of default modules and hooks.\n */\nexport class ShaderAssembler {\n /** Default ShaderAssembler instance */\n static defaultShaderAssembler;\n /** Hook functions */\n _hookFunctions = [];\n /** Shader modules */\n _defaultModules = [];\n /**\n * A default shader assembler instance - the natural place to register default modules and hooks\n * @returns\n */\n static getDefaultShaderAssembler() {\n ShaderAssembler.defaultShaderAssembler =\n ShaderAssembler.defaultShaderAssembler || new ShaderAssembler();\n return ShaderAssembler.defaultShaderAssembler;\n }\n /**\n * Add a default module that does not have to be provided with every call to assembleShaders()\n */\n addDefaultModule(module) {\n if (!this._defaultModules.find(m => m.name === (typeof module === 'string' ? module : module.name))) {\n this._defaultModules.push(module);\n }\n }\n /**\n * Remove a default module\n */\n removeDefaultModule(module) {\n const moduleName = typeof module === 'string' ? module : module.name;\n this._defaultModules = this._defaultModules.filter(m => m.name !== moduleName);\n }\n /**\n * Register a shader hook\n * @param hook\n * @param opts\n */\n addShaderHook(hook, opts) {\n if (opts) {\n hook = Object.assign(opts, { hook });\n }\n this._hookFunctions.push(hook);\n }\n /**\n * Assemble a pair of shaders into a single shader program\n * @param platformInfo\n * @param props\n * @returns\n */\n assembleShader(props) {\n const modules = this._getModuleList(props.modules); // Combine with default modules\n const hookFunctions = this._hookFunctions; // TODO - combine with default hook functions\n const options = selectShaders(props);\n const assembled = assembleShaderWGSL({\n platformInfo: props.platformInfo,\n ...options,\n modules,\n hookFunctions\n });\n return { ...assembled, modules };\n }\n /**\n * Assemble a pair of shaders into a single shader program\n * @param platformInfo\n * @param props\n * @returns\n */\n assembleShaderPair(props) {\n const options = selectShaders(props);\n const modules = this._getModuleList(props.modules); // Combine with default modules\n const hookFunctions = this._hookFunctions; // TODO - combine with default hook functions\n const { platformInfo } = props;\n const isWGSL = props.platformInfo.shaderLanguage === 'wgsl';\n const assembled = isWGSL\n ? assembleShaderPairWGSL({ platformInfo, ...options, modules, hookFunctions })\n : assembleShaderPairGLSL({ platformInfo, ...options, modules, hookFunctions });\n return { ...assembled, modules };\n }\n /**\n * Dedupe and combine with default modules\n */\n _getModuleList(appModules = []) {\n const modules = new Array(this._defaultModules.length + appModules.length);\n const seen = {};\n let count = 0;\n for (let i = 0, len = this._defaultModules.length; i < len; ++i) {\n const module = this._defaultModules[i];\n const name = module.name;\n modules[count++] = module;\n seen[name] = true;\n }\n for (let i = 0, len = appModules.length; i < len; ++i) {\n const module = appModules[i];\n const name = module.name;\n if (!seen[name]) {\n modules[count++] = module;\n seen[name] = true;\n }\n }\n modules.length = count;\n return ShaderModuleInstance.instantiateModules(modules);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { ShaderModuleInstance } from \"./shader-module-instance.js\";\nexport function normalizeShaderModule(module) {\n if (!module.normalized) {\n module.normalized = true;\n if (module.uniformPropTypes && !module.getUniforms) {\n const shaderModule = new ShaderModuleInstance(module);\n module.getUniforms = shaderModule.getUniforms.bind(shaderModule);\n }\n }\n return module;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"./highlight.js\";\nconst FS_GLES = `\\\nout vec4 transform_output;\nvoid main() {\ntransform_output = vec4(0);\n}`;\nconst FS300 = `#version 300 es\\n${FS_GLES}`;\n// Prase given glsl line and return qualifier details or null\nexport function getQualifierDetails(line, qualifiers) {\n qualifiers = Array.isArray(qualifiers) ? qualifiers : [qualifiers];\n const words = line.replace(/^\\s+/, '').split(/\\s+/);\n // TODO add support for precession qualifiers (highp, mediump and lowp)\n const [qualifier, type, definition] = words;\n if (!qualifiers.includes(qualifier) || !type || !definition) {\n return null;\n }\n const name = definition.split(';')[0];\n return { qualifier, type, name };\n}\n/**\n * Given the shader input and output variable names,\n * builds and return a pass through fragment shader.\n */\nexport function getPassthroughFS(options) {\n const { input, inputChannels, output } = options || {};\n if (!input) {\n // Default shader\n return FS300;\n }\n if (!inputChannels) {\n throw new Error('inputChannels');\n }\n const inputType = channelCountToType(inputChannels);\n const outputValue = convertToVec4(input, inputChannels);\n return `\\\n#version 300 es\nin ${inputType} ${input};\nout vec4 ${output};\nvoid main() {\n ${output} = ${outputValue};\n}`;\n}\n/** convert glsl type to suffix */\nexport function typeToChannelSuffix(type) {\n // prettier-ignore\n switch (type) {\n case 'float': return 'x';\n case 'vec2': return 'xy';\n case 'vec3': return 'xyz';\n case 'vec4': return 'xyzw';\n default:\n throw new Error(type);\n }\n}\n/** convert glsl type to channel count */\nexport function typeToChannelCount(type) {\n // prettier-ignore\n switch (type) {\n case 'float': return 1;\n case 'vec2': return 2;\n case 'vec3': return 3;\n case 'vec4': return 4;\n default:\n throw new Error(type);\n }\n}\nfunction channelCountToType(channels) {\n // prettier-ignore\n switch (channels) {\n case 1: return 'float';\n case 2: return 'vec2';\n case 3: return 'vec3';\n case 4: return 'vec4';\n default:\n throw new Error(`invalid channels: ${channels}`);\n }\n}\n/** Returns glsl instruction for converting to vec4 */\nexport function convertToVec4(variable, channels) {\n // prettier-ignore\n switch (channels) {\n case 1: return `vec4(${variable}, 0.0, 0.0, 1.0)`;\n case 2: return `vec4(${variable}, 0.0, 1.0)`;\n case 3: return `vec4(${variable}, 1.0)`;\n case 4: return variable;\n default:\n throw new Error(`invalid channels: ${channels}`);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Capitalize first letter of a string\n * @param {string} str\n * @returns {string}\n */\nexport function capitalize(str) {\n return typeof str === 'string' ? str.charAt(0).toUpperCase() + str.slice(1) : str;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { capitalize } from \"../utils/capitalize.js\";\nexport function generateGLSLForModule(module, options) {\n return generateGLSLUniformDeclarations(module, options);\n}\nfunction generateGLSLUniformDeclarations(module, options) {\n const glsl = [];\n // => uniform UniformBlockName {\n switch (options.uniforms) {\n case 'scoped-interface-blocks':\n case 'unscoped-interface-blocks':\n glsl.push(`uniform ${capitalize(module.name)} {`);\n break;\n case 'uniforms':\n // ignore\n }\n for (const [uniformName, uniformFormat] of Object.entries(module.uniformTypes || {})) {\n const glslUniformType = getGLSLUniformType(uniformFormat);\n switch (options.uniforms) {\n case 'scoped-interface-blocks':\n // => uniform UniformBlockName {\n glsl.push(` ${glslUniformType} ${uniformName};`);\n break;\n case 'unscoped-interface-blocks':\n // => uniform UniformBlockName {\n glsl.push(` ${glslUniformType} ${module.name}_${uniformName};`);\n break;\n case 'uniforms':\n glsl.push(`uniform ${glslUniformType} ${module.name}_${uniformName};`);\n }\n }\n switch (options.uniforms) {\n case 'scoped-interface-blocks':\n glsl.push(`} ${module.name};`);\n break;\n case 'unscoped-interface-blocks':\n glsl.push('};');\n break;\n case 'uniforms':\n // ignore\n }\n // final new line\n glsl.push('');\n return glsl.join('\\n');\n}\n/** Map a luma.gl WebGPU style uniform type to GLSL */\nfunction getGLSLUniformType(uniformFormat) {\n const UNIFORM_TYPE_TO_GLSL = {\n f32: 'float',\n i32: 'int',\n u32: 'uint',\n 'vec2': 'vec2',\n 'vec3': 'vec3',\n 'vec4': 'vec4',\n 'vec2': 'ivec2',\n 'vec3': 'ivec3',\n 'vec4': 'ivec4',\n 'vec2': 'uvec2',\n 'vec3': 'uvec3',\n 'vec4': 'uvec4',\n 'mat2x2': 'mat2',\n 'mat2x3': 'mat2x3',\n 'mat2x4': 'mat2x4',\n 'mat3x2': 'mat3x2',\n 'mat3x3': 'mat3',\n 'mat3x4': 'mat3x4',\n 'mat4x2': 'mat4x2',\n 'mat4x3': 'mat4x3',\n 'mat4x4': 'mat4'\n };\n const glsl = UNIFORM_TYPE_TO_GLSL[uniformFormat];\n return glsl;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { capitalize } from \"../utils/capitalize.js\";\nexport function generateWGSLForModule(module, options) {\n return generateWGSLUniformDeclarations(module, options);\n}\nexport function generateWGSLUniformDeclarations(module, options) {\n const wgsl = [];\n // => uniform UniformBlockName {\n wgsl.push(`struct ${capitalize(module.name)} {`);\n for (const [uniformName, uniformFormat] of Object.entries(module?.uniformTypes || {})) {\n const wgslUniformType = uniformFormat;\n wgsl.push(` ${uniformName} : ${wgslUniformType};`);\n }\n wgsl.push('};');\n wgsl.push(`var ${module.name} : ${capitalize(module.name)};`);\n return wgsl.join('\\n');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { generateGLSLForModule } from \"./glsl/generate-glsl.js\";\nimport { generateWGSLForModule } from \"./wgsl/generate-wgsl.js\";\n/** Generates shader code for a module */\nexport function generateShaderForModule(module, options) {\n switch (options.shaderLanguage) {\n case 'glsl':\n return generateGLSLForModule(module, options);\n case 'wgsl':\n return generateWGSLForModule(module, options);\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { log } from '@luma.gl/core';\nimport { WgslReflect } from 'wgsl_reflect';\n/**\n * Parse a ShaderLayout from WGSL shader source code.\n * @param source WGSL source code (can contain both @vertex and @fragment entry points)\n * @returns\n */\nexport function getShaderLayoutFromWGSL(source) {\n const shaderLayout = { attributes: [], bindings: [] };\n let parsedWGSL;\n try {\n parsedWGSL = parseWGSL(source);\n }\n catch (error) {\n log.error(error.message)();\n return shaderLayout;\n }\n for (const uniform of parsedWGSL.uniforms) {\n const members = [];\n for (const attribute of uniform.type?.members || []) {\n members.push({\n name: attribute.name,\n type: getType(attribute.type)\n });\n }\n shaderLayout.bindings.push({\n type: 'uniform',\n name: uniform.name,\n location: uniform.binding,\n // @ts-expect-error\n group: uniform.group,\n members\n });\n }\n const vertex = parsedWGSL.entry.vertex[0]; // \"main\"\n // Vertex shader inputs\n const attributeCount = vertex?.inputs.length || 0; // inputs to \"main\"\n for (let i = 0; i < attributeCount; i++) {\n const wgslAttribute = vertex.inputs[i];\n // locationType can be \"builtin\"\n if (wgslAttribute.locationType === 'location') {\n const type = getType(wgslAttribute.type);\n shaderLayout.attributes.push({\n name: wgslAttribute.name,\n location: Number(wgslAttribute.location),\n type\n });\n }\n }\n return shaderLayout;\n}\n/** Get a valid shader attribute type string from a wgsl-reflect type */\nfunction getType(type) {\n return type.format ? `${type.name}<${type.format.name}>` : type.name;\n}\nfunction parseWGSL(source) {\n try {\n return new WgslReflect(source);\n }\n catch (error) {\n if (error instanceof Error) {\n throw error;\n }\n let message = 'WGSL parse error';\n if (typeof error === 'object' && error?.message) {\n message += `: ${error.message} `;\n }\n if (typeof error === 'object' && error?.token) {\n message += error.token.line || '';\n }\n throw new Error(message, { cause: error });\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nfloat random(vec3 scale, float seed) {\nreturn fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n`;\n/** Quick random generator for fragment shaders */\nexport const random = {\n name: 'random',\n fs\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\n// import {ShaderModule} from '../../types';\nconst fp32shader = `\\\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\nfloat sin_taylor_fp32(float a) {\nfloat r, s, t, x;\nif (a == 0.0) {\nreturn 0.0;\n}\nx = -a * a;\ns = a;\nr = a;\nr = r * x;\nt = r * INVERSE_FACTORIAL_3;\ns = s + t;\nr = r * x;\nt = r * INVERSE_FACTORIAL_5;\ns = s + t;\nr = r * x;\nt = r * INVERSE_FACTORIAL_7;\ns = s + t;\nr = r * x;\nt = r * INVERSE_FACTORIAL_9;\ns = s + t;\nreturn s;\n}\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\nif (a == 0.0) {\nsin_t = 0.0;\ncos_t = 1.0;\n}\nsin_t = sin_taylor_fp32(a);\ncos_t = sqrt(1.0 - sin_t * sin_t);\n}\nfloat tan_taylor_fp32(float a) {\nfloat sin_a;\nfloat cos_a;\nif (a == 0.0) {\nreturn 0.0;\n}\nfloat z = floor(a / TWO_PI);\nfloat r = a - TWO_PI * z;\nfloat t;\nfloat q = floor(r / PI_2 + 0.5);\nint j = int(q);\nif (j < -2 || j > 2) {\nreturn 1.0 / 0.0;\n}\nt = r - PI_2 * q;\nq = floor(t / PI_16 + 0.5);\nint k = int(q);\nint abs_k = int(abs(float(k)));\nif (abs_k > 4) {\nreturn 1.0 / 0.0;\n} else {\nt = t - PI_16 * q;\n}\nfloat u = 0.0;\nfloat v = 0.0;\nfloat sin_t, cos_t;\nfloat s, c;\nsincos_taylor_fp32(t, sin_t, cos_t);\nif (k == 0) {\ns = sin_t;\nc = cos_t;\n} else {\nif (abs(float(abs_k) - 1.0) < 0.5) {\nu = COS_TABLE_0;\nv = SIN_TABLE_0;\n} else if (abs(float(abs_k) - 2.0) < 0.5) {\nu = COS_TABLE_1;\nv = SIN_TABLE_1;\n} else if (abs(float(abs_k) - 3.0) < 0.5) {\nu = COS_TABLE_2;\nv = SIN_TABLE_2;\n} else if (abs(float(abs_k) - 4.0) < 0.5) {\nu = COS_TABLE_3;\nv = SIN_TABLE_3;\n}\nif (k > 0) {\ns = u * sin_t + v * cos_t;\nc = u * cos_t - v * sin_t;\n} else {\ns = u * sin_t - v * cos_t;\nc = u * cos_t + v * sin_t;\n}\n}\nif (j == 0) {\nsin_a = s;\ncos_a = c;\n} else if (j == 1) {\nsin_a = c;\ncos_a = -s;\n} else if (j == -1) {\nsin_a = -c;\ncos_a = s;\n} else {\nsin_a = -s;\ncos_a = -c;\n}\nreturn sin_a / cos_a;\n}\n#endif\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nreturn tan_taylor_fp32(a);\n#else\nreturn tan(a);\n#endif\n}\n`;\n/**\n * 32 bit math library (fixups for GPUs)\n */\nexport const fp32 = {\n name: 'fp32',\n vs: fp32shader\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\n// cyan color\nconst DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];\nconst vs = `\\\nuniform pickingUniforms {\nfloat isActive;\nfloat isAttribute;\nfloat isHighlightActive;\nfloat useFloatColors;\nvec3 highlightedObjectColor;\nvec4 highlightColor;\n} picking;\nout vec4 picking_vRGBcolor_Avalid;\nvec3 picking_normalizeColor(vec3 color) {\nreturn picking.useFloatColors > 0.5 ? color : color / 255.0;\n}\nvec4 picking_normalizeColor(vec4 color) {\nreturn picking.useFloatColors > 0.5 ? color : color / 255.0;\n}\nbool picking_isColorZero(vec3 color) {\nreturn dot(color, vec3(1.0)) < 0.00001;\n}\nbool picking_isColorValid(vec3 color) {\nreturn dot(color, vec3(1.0)) > 0.00001;\n}\nbool isVertexHighlighted(vec3 vertexColor) {\nvec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);\nreturn\nbool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor));\n}\nvoid picking_setPickingColor(vec3 pickingColor) {\npickingColor = picking_normalizeColor(pickingColor);\nif (bool(picking.isActive)) {\npicking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\nif (!bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.rgb = pickingColor;\n}\n} else {\npicking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor));\n}\n}\nvoid picking_setPickingAttribute(float value) {\nif (bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.r = value;\n}\n}\nvoid picking_setPickingAttribute(vec2 value) {\nif (bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.rg = value;\n}\n}\nvoid picking_setPickingAttribute(vec3 value) {\nif (bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.rgb = value;\n}\n}\n`;\nconst fs = `\\\nuniform pickingUniforms {\nfloat isActive;\nfloat isAttribute;\nfloat isHighlightActive;\nfloat useFloatColors;\nvec3 highlightedObjectColor;\nvec4 highlightColor;\n} picking;\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\nif (picking.isActive > 0.5) {\nreturn color;\n}\nbool selected = bool(picking_vRGBcolor_Avalid.a);\nif (selected) {\nfloat highLightAlpha = picking.highlightColor.a;\nfloat blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\nfloat highLightRatio = highLightAlpha / blendedAlpha;\nvec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio);\nreturn vec4(blendedRGB, blendedAlpha);\n} else {\nreturn color;\n}\n}\nvec4 picking_filterPickingColor(vec4 color) {\nif (bool(picking.isActive)) {\nif (picking_vRGBcolor_Avalid.a == 0.0) {\ndiscard;\n}\nreturn picking_vRGBcolor_Avalid;\n}\nreturn color;\n}\nvec4 picking_filterColor(vec4 color) {\nvec4 highlightColor = picking_filterHighlightColor(color);\nreturn picking_filterPickingColor(highlightColor);\n}\n`;\n/**\n * Provides support for color-coding-based picking and highlighting.\n * In particular, supports picking a specific instance in an instanced\n * draw call and highlighting an instance based on its picking color,\n * and correspondingly, supports picking and highlighting groups of\n * primitives with the same picking color in non-instanced draw-calls\n */\nexport const picking = {\n name: 'picking',\n vs,\n fs,\n uniformTypes: {\n isActive: 'f32',\n isAttribute: 'f32',\n isHighlightActive: 'f32',\n useFloatColors: 'f32',\n highlightedObjectColor: 'vec3',\n highlightColor: 'vec4'\n },\n defaultUniforms: {\n isActive: false,\n isAttribute: false,\n isHighlightActive: false,\n useFloatColors: true,\n highlightedObjectColor: [0, 0, 0],\n highlightColor: DEFAULT_HIGHLIGHT_COLOR\n },\n getUniforms\n};\nfunction getUniforms(opts = {}, prevUniforms) {\n const uniforms = {};\n if (opts.highlightedObjectColor === undefined) {\n // Unless highlightedObjectColor explicitly null or set, do not update state\n }\n else if (opts.highlightedObjectColor === null) {\n uniforms.isHighlightActive = false;\n }\n else {\n uniforms.isHighlightActive = true;\n const highlightedObjectColor = opts.highlightedObjectColor.slice(0, 3);\n uniforms.highlightedObjectColor = highlightedObjectColor;\n }\n if (opts.highlightColor) {\n const color = Array.from(opts.highlightColor, x => x / 255);\n if (!Number.isFinite(color[3])) {\n color[3] = 1;\n }\n uniforms.highlightColor = color;\n }\n if (opts.isActive !== undefined) {\n uniforms.isActive = Boolean(opts.isActive);\n uniforms.isAttribute = Boolean(opts.isAttribute);\n }\n if (opts.useFloatColors !== undefined) {\n uniforms.useFloatColors = Boolean(opts.useFloatColors);\n }\n return uniforms;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const lightingUniforms = `\\\nprecision highp int;\nstruct AmbientLight {\nvec3 color;\n};\nstruct PointLight {\nvec3 color;\nvec3 position;\nvec3 attenuation;\n};\nstruct DirectionalLight {\nvec3 color;\nvec3 direction;\n};\nuniform lightingUniforms {\nint enabled;\nint lightType;\nint directionalLightCount;\nint pointLightCount;\nvec3 ambientColor;\nvec3 lightColor0;\nvec3 lightPosition0;\nvec3 lightDirection0;\nvec3 lightAttenuation0;\nvec3 lightColor1;\nvec3 lightPosition1;\nvec3 lightDirection1;\nvec3 lightAttenuation1;\nvec3 lightColor2;\nvec3 lightPosition2;\nvec3 lightDirection2;\nvec3 lightAttenuation2;\n} lighting;\nPointLight lighting_getPointLight(int index) {\nswitch (index) {\ncase 0:\nreturn PointLight(lighting.lightColor0, lighting.lightPosition0, lighting.lightAttenuation0);\ncase 1:\nreturn PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1);\ncase 2:\ndefault:\nreturn PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2);\n}\n}\nDirectionalLight lighting_getDirectionalLight(int index) {\nswitch (index) {\ncase 0:\nreturn DirectionalLight(lighting.lightColor0, lighting.lightDirection0);\ncase 1:\nreturn DirectionalLight(lighting.lightColor1, lighting.lightDirection1);\ncase 2:\ndefault:\nreturn DirectionalLight(lighting.lightColor2, lighting.lightDirection2);\n}\n}\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\nreturn pointLight.attenuation.x\n+ pointLight.attenuation.y * distance\n+ pointLight.attenuation.z * distance * distance;\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lightingUniforms } from \"./lighting-uniforms-glsl.js\";\nimport { log } from '@luma.gl/core';\n/** Max number of supported lights (in addition to ambient light */\nconst MAX_LIGHTS = 3;\n/** Whether to divide */\nconst COLOR_FACTOR = 255.0;\n/** Shader type field for lights */\nvar LIGHT_TYPE;\n(function (LIGHT_TYPE) {\n LIGHT_TYPE[LIGHT_TYPE[\"POINT\"] = 0] = \"POINT\";\n LIGHT_TYPE[LIGHT_TYPE[\"DIRECTIONAL\"] = 1] = \"DIRECTIONAL\";\n})(LIGHT_TYPE || (LIGHT_TYPE = {}));\n/** UBO ready lighting module */\nexport const lighting = {\n name: 'lighting',\n vs: lightingUniforms,\n fs: lightingUniforms,\n getUniforms(props, prevUniforms) {\n return getUniforms(props);\n },\n defines: {\n MAX_LIGHTS\n },\n uniformTypes: {\n enabled: 'i32',\n lightType: 'i32',\n directionalLightCount: 'i32',\n pointLightCount: 'i32',\n ambientLightColor: 'vec3',\n // TODO define as arrays once we have appropriate uniformTypes\n lightColor0: 'vec3',\n lightPosition0: 'vec3',\n // TODO - could combine direction and attenuation\n lightDirection0: 'vec3',\n lightAttenuation0: 'vec3',\n lightColor1: 'vec3',\n lightPosition1: 'vec3',\n lightDirection1: 'vec3',\n lightAttenuation1: 'vec3',\n lightColor2: 'vec3',\n lightPosition2: 'vec3',\n lightDirection2: 'vec3',\n lightAttenuation2: 'vec3'\n },\n defaultUniforms: {\n enabled: 1,\n lightType: LIGHT_TYPE.POINT,\n directionalLightCount: 0,\n pointLightCount: 0,\n ambientLightColor: [0.1, 0.1, 0.1],\n lightColor0: [1, 1, 1],\n lightPosition0: [1, 1, 2],\n // TODO - could combine direction and attenuation\n lightDirection0: [1, 1, 1],\n lightAttenuation0: [1, 0, 0],\n lightColor1: [1, 1, 1],\n lightPosition1: [1, 1, 2],\n lightDirection1: [1, 1, 1],\n lightAttenuation1: [1, 0, 0],\n lightColor2: [1, 1, 1],\n lightPosition2: [1, 1, 2],\n lightDirection2: [1, 1, 1],\n lightAttenuation2: [1, 0, 0]\n }\n};\nfunction getUniforms(props, prevUniforms = {}) {\n // Copy props so we can modify\n props = props ? { ...props } : props;\n // TODO legacy\n if (!props) {\n return { ...lighting.defaultUniforms };\n }\n // Support for array of lights. Type of light is detected by type field\n if (props.lights) {\n props = { ...props, ...extractLightTypes(props.lights), lights: undefined };\n }\n // Specify lights separately\n const { ambientLight, pointLights, directionalLights } = props || {};\n const hasLights = ambientLight ||\n (pointLights && pointLights.length > 0) ||\n (directionalLights && directionalLights.length > 0);\n // TODO - this may not be the correct decision\n if (!hasLights) {\n return { ...lighting.defaultUniforms, enabled: 0 };\n }\n const uniforms = {\n ...lighting.defaultUniforms,\n ...prevUniforms,\n ...getLightSourceUniforms({ ambientLight, pointLights, directionalLights })\n };\n if (props.enabled !== undefined) {\n uniforms.enabled = props.enabled ? 1 : 0;\n }\n return uniforms;\n}\nfunction getLightSourceUniforms({ ambientLight, pointLights = [], directionalLights = [] }) {\n const lightSourceUniforms = {};\n lightSourceUniforms.ambientLightColor = convertColor(ambientLight);\n let currentLight = 0;\n for (const pointLight of pointLights) {\n lightSourceUniforms.lightType = LIGHT_TYPE.POINT;\n const i = currentLight;\n lightSourceUniforms[`lightColor${i}`] = convertColor(pointLight);\n lightSourceUniforms[`lightPosition${i}`] = pointLight.position;\n lightSourceUniforms[`lightAttenuation${i}`] = pointLight.attenuation || [1, 0, 0];\n currentLight++;\n }\n for (const directionalLight of directionalLights) {\n lightSourceUniforms.lightType = LIGHT_TYPE.DIRECTIONAL;\n const i = currentLight;\n lightSourceUniforms[`lightColor${i}`] = convertColor(directionalLight);\n lightSourceUniforms[`lightDirection${i}`] = directionalLight.direction;\n currentLight++;\n }\n if (currentLight > MAX_LIGHTS) {\n log.warn('MAX_LIGHTS exceeded')();\n }\n lightSourceUniforms.directionalLightCount = directionalLights.length;\n lightSourceUniforms.pointLightCount = pointLights.length;\n return lightSourceUniforms;\n}\nfunction extractLightTypes(lights) {\n const lightSources = { pointLights: [], directionalLights: [] };\n for (const light of lights || []) {\n switch (light.type) {\n case 'ambient':\n // Note: Only uses last ambient light\n // TODO - add ambient light sources on CPU?\n lightSources.ambientLight = light;\n break;\n case 'directional':\n lightSources.directionalLights?.push(light);\n break;\n case 'point':\n lightSources.pointLights?.push(light);\n break;\n default:\n // eslint-disable-next-line\n // console.warn(light.type);\n }\n }\n return lightSources;\n}\n/** Take color 0-255 and intensity as input and output 0.0-1.0 range */\nfunction convertColor(colorDef = {}) {\n const { color = [0, 0, 0], intensity = 1.0 } = colorDef;\n return color.map(component => (component * intensity) / COLOR_FACTOR);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\n// TODO\nexport const VS_WGSL = /* WGSL */ `\\ \nvoid dirlight_setNormal(normal: vec3) {\n dirlight_vNormal = normalize(normal);\n}\n`;\n// TODO\nexport const FS_WGSL = /* WGSL */ `\\\nuniform dirlightUniforms {\n vec3 lightDirection;\n} dirlight;\n\n// Returns color attenuated by angle from light source\nfn dirlight_filterColor(color: vec4, dirlightInputs): vec4 {\n const d: float = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));\n return vec4(color.rgb * d, color.a);\n}\n`;\nconst VS_GLSL = `\\\nout vec3 dirlight_vNormal;\nvoid dirlight_setNormal(vec3 normal) {\ndirlight_vNormal = normalize(normal);\n}\n`;\nconst FS_GLSL = `\\\nuniform dirlightUniforms {\nvec3 lightDirection;\n} dirlight;\nin vec3 dirlight_vNormal;\nvec4 dirlight_filterColor(vec4 color) {\nfloat d = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));\nreturn vec4(color.rgb * d, color.a);\n}\n`;\n/**\n * Cheap lighting - single directional light, single dot product, one uniform\n */\nexport const dirlight = {\n name: 'dirlight',\n dependencies: [],\n vs: VS_GLSL,\n fs: FS_GLSL,\n // fragmentInputs: [\n // {\n // name: 'dirlight_vNormal',\n // type: 'vec3'\n // }\n // ],\n uniformTypes: {\n lightDirection: 'vec3'\n },\n defaultUniforms: {\n lightDirection: [1, 1, 2]\n },\n getUniforms\n};\nfunction getUniforms(opts = dirlight.defaultUniforms) {\n const uniforms = {};\n if (opts.lightDirection) {\n // eslint-disable-next-line camelcase\n uniforms.dirlight_uLightDirection = opts.lightDirection;\n }\n return uniforms;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const PHONG_VS = `\\\nuniform phongMaterialUniforms {\nuniform float ambient;\nuniform float diffuse;\nuniform float shininess;\nuniform vec3 specularColor;\n} material;\n`;\nexport const PHONG_FS = `\\\nuniform phongMaterialUniforms {\nuniform float ambient;\nuniform float diffuse;\nuniform float shininess;\nuniform vec3 specularColor;\n} material;\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\nvec3 halfway_direction = normalize(light_direction + view_direction);\nfloat lambertian = dot(light_direction, normal_worldspace);\nfloat specular = 0.0;\nif (lambertian > 0.0) {\nfloat specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\nspecular = pow(specular_angle, material.shininess);\n}\nlambertian = max(lambertian, 0.0);\nreturn (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;\n}\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\nvec3 lightColor = surfaceColor;\nif (lighting.enabled == 0) {\nreturn lightColor;\n}\nvec3 view_direction = normalize(cameraPosition - position_worldspace);\nlightColor = material.ambient * surfaceColor * lighting.ambientColor;\nfor (int i = 0; i < lighting.pointLightCount; i++) {\nPointLight pointLight = lighting_getPointLight(i);\nvec3 light_position_worldspace = pointLight.position;\nvec3 light_direction = normalize(light_position_worldspace - position_worldspace);\nfloat light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace));\nlightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation);\n}\nint totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount);\nfor (int i = lighting.pointLightCount; i < totalLights; i++) {\nDirectionalLight directionalLight = lighting_getDirectionalLight(i);\nlightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n}\nreturn lightColor;\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lighting } from \"../lights/lighting-uniforms.js\";\nimport { PHONG_VS, PHONG_FS } from \"../phong-material/phong-shaders-glsl.js\";\n/** In Gouraud shading, color is calculated for each triangle vertex normal, and then color is interpolated colors across the triangle */\nexport const gouraudMaterial = {\n name: 'gouraudMaterial',\n // Note these are switched between phong and gouraud\n vs: PHONG_FS.replace('phongMaterial', 'gouraudMaterial'),\n fs: PHONG_VS.replace('phongMaterial', 'gouraudMaterial'),\n defines: {\n LIGHTING_VERTEX: 1\n },\n dependencies: [lighting],\n uniformTypes: {\n ambient: 'f32',\n diffuse: 'f32',\n shininess: 'f32',\n specularColor: 'vec3'\n },\n defaultUniforms: {\n ambient: 0.35,\n diffuse: 0.6,\n shininess: 32,\n specularColor: [0.15, 0.15, 0.15]\n },\n getUniforms(props) {\n const uniforms = { ...props };\n if (uniforms.specularColor) {\n uniforms.specularColor = uniforms.specularColor.map(x => x / 255);\n }\n return { ...gouraudMaterial.defaultUniforms, ...uniforms };\n }\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lighting } from \"../lights/lighting-uniforms.js\";\nimport { PHONG_VS, PHONG_FS } from \"./phong-shaders-glsl.js\";\n/** In Phong shading, the normal vector is linearly interpolated across the surface of the polygon from the polygon's vertex normals. */\nexport const phongMaterial = {\n name: 'phongMaterial',\n // Note these are switched between phong and gouraud\n vs: PHONG_VS,\n fs: PHONG_FS,\n defines: {\n LIGHTING_FRAGMENT: 1\n },\n dependencies: [lighting],\n uniformTypes: {\n ambient: 'f32',\n diffuse: 'f32',\n shininess: 'f32',\n specularColor: 'vec3'\n },\n defaultUniforms: {\n ambient: 0.35,\n diffuse: 0.6,\n shininess: 32,\n specularColor: [0.15, 0.15, 0.15]\n },\n getUniforms(props) {\n const uniforms = { ...props };\n if (uniforms.specularColor) {\n uniforms.specularColor = uniforms.specularColor.map(x => x / 255);\n }\n return { ...phongMaterial.defaultUniforms, ...uniforms };\n }\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const vs = `\\\nuniform projection {\nmat4 u_MVPMatrix;\nmat4 u_ModelMatrix;\nmat4 u_NormalMatrix;\nvec3 u_Camera;\n}\nvarying vec3 pbr_vPosition;\nvarying vec2 pbr_vUV;\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n# else\nvarying vec3 pbr_vNormal;\n# endif\n#endif\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\nvec4 pos = u_ModelMatrix * position;\npbr_vPosition = vec3(pos.xyz) / pos.w;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));\nvec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));\nvec3 bitangentW = cross(normalW, tangentW) * tangent.w;\npbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else\npbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n#ifdef HAS_UV\npbr_vUV = uv;\n#else\npbr_vUV = vec2(0.,0.);\n#endif\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Attribution:\n// MIT license, Copyright (c) 2016-2017 Mohamad Moneimne and Contributors\n// This fragment shader defines a reference implementation for Physically Based Shading of\n// a microfacet surface material defined by a glTF model.\n// TODO - better do the checks outside of shader\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const fs = `\\\nprecision highp float;\nuniform Projection {\nuniform vec3 u_Camera;\n};\nuniform pbrMaterial {\nbool unlit;\nbool baseColorMapEnabled;\nvec4 baseColorFactor;\nbool normalMapEnabled;\nfloat normalScale;\nbool emissiveMapEnabled;\nvec3 emissiveFactor;\nvec2 metallicRoughnessValues;\nbool metallicRoughnessMapEnabled;\nbool occlusionMapEnabled;\nfloat occlusionStrength;\nbool alphaCutoffEnabled;\nfloat alphaCutoff;\nbool IBLenabled;\nvec2 scaleIBLAmbient;\nvec4 scaleDiffBaseMR;\nvec4 scaleFGDSpec;\n} u_pbrMaterial;\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D u_BaseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D u_NormalSampler;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D u_EmissiveSampler;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D u_MetallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D u_OcclusionSampler;\n#endif\n#ifdef USE_IBL\nuniform samplerCube u_DiffuseEnvSampler;\nuniform samplerCube u_SpecularEnvSampler;\nuniform sampler2D u_brdfLUT;\n#endif\nvarying vec3 pbr_vPosition;\nvarying vec2 pbr_vUV;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n#else\nvarying vec3 pbr_vNormal;\n#endif\n#endif\nstruct PBRInfo {\nfloat NdotL;\nfloat NdotV;\nfloat NdotH;\nfloat LdotH;\nfloat VdotH;\nfloat perceptualRoughness;\nfloat metalness;\nvec3 reflectance0;\nvec3 reflectance90;\nfloat alphaRoughness;\nvec3 diffuseColor;\nvec3 specularColor;\nvec3 n;\nvec3 v;\n};\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\nvec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n#else\nvec3 bLess = step(vec3(0.04045),srgbIn.xyz);\nvec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif\nreturn vec4(linOut,srgbIn.w);;\n#else\nreturn srgbIn;\n#endif\n}\nvec3 getNormal()\n{\n#ifndef HAS_TANGENTS\nvec3 pos_dx = dFdx(pbr_vPosition);\nvec3 pos_dy = dFdy(pbr_vPosition);\nvec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\nvec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\nvec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n#ifdef HAS_NORMALS\nvec3 ng = normalize(pbr_vNormal);\n#else\nvec3 ng = cross(pos_dx, pos_dy);\n#endif\nt = normalize(t - ng * dot(ng, t));\nvec3 b = normalize(cross(ng, t));\nmat3 tbn = mat3(t, b, ng);\n#else\nmat3 tbn = pbr_vTBN;\n#endif\n#ifdef HAS_NORMALMAP\nvec3 n = texture2D(u_NormalSampler, pbr_vUV).rgb;\nn = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_pbrMaterial.normalScale, u_pbrMaterial.normalScale, 1.0)));\n#else\nvec3 n = normalize(tbn[2].xyz);\n#endif\nreturn n;\n}\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection)\n{\nfloat mipCount = 9.0;\nfloat lod = (pbrInfo.perceptualRoughness * mipCount);\nvec3 brdf = SRGBtoLINEAR(texture2D(u_brdfLUT,\nvec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;\nvec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;\n#ifdef USE_TEX_LOD\nvec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;\n#else\nvec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;\n#endif\nvec3 diffuse = diffuseLight * pbrInfo.diffuseColor;\nvec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);\ndiffuse *= u_pbrMaterial.scaleIBLAmbient.x;\nspecular *= u_pbrMaterial.scaleIBLAmbient.y;\nreturn diffuse + specular;\n}\n#endif\nvec3 diffuse(PBRInfo pbrInfo)\n{\nreturn pbrInfo.diffuseColor / M_PI;\n}\nvec3 specularReflection(PBRInfo pbrInfo)\n{\nreturn pbrInfo.reflectance0 +\n(pbrInfo.reflectance90 - pbrInfo.reflectance0) *\npow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);\n}\nfloat geometricOcclusion(PBRInfo pbrInfo)\n{\nfloat NdotL = pbrInfo.NdotL;\nfloat NdotV = pbrInfo.NdotV;\nfloat r = pbrInfo.alphaRoughness;\nfloat attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\nfloat attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\nreturn attenuationL * attenuationV;\n}\nfloat microfacetDistribution(PBRInfo pbrInfo)\n{\nfloat roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;\nfloat f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;\nreturn roughnessSq / (M_PI * f * f);\n}\nvoid PBRInfo_setAmbientLight(inout PBRInfo pbrInfo) {\npbrInfo.NdotL = 1.0;\npbrInfo.NdotH = 0.0;\npbrInfo.LdotH = 0.0;\npbrInfo.VdotH = 1.0;\n}\nvoid PBRInfo_setDirectionalLight(inout PBRInfo pbrInfo, vec3 lightDirection) {\nvec3 n = pbrInfo.n;\nvec3 v = pbrInfo.v;\nvec3 l = normalize(lightDirection);\nvec3 h = normalize(l+v);\npbrInfo.NdotL = clamp(dot(n, l), 0.001, 1.0);\npbrInfo.NdotH = clamp(dot(n, h), 0.0, 1.0);\npbrInfo.LdotH = clamp(dot(l, h), 0.0, 1.0);\npbrInfo.VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\nvoid PBRInfo_setPointLight(inout PBRInfo pbrInfo, PointLight pointLight) {\nvec3 light_direction = normalize(pointLight.position - pbr_vPosition);\nPBRInfo_setDirectionalLight(pbrInfo, light_direction);\n}\nvec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) {\nvec3 F = specularReflection(pbrInfo);\nfloat G = geometricOcclusion(pbrInfo);\nfloat D = microfacetDistribution(pbrInfo);\nvec3 diffuseContrib = (1.0 - F) * diffuse(pbrInfo);\nvec3 specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);\nreturn pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);\n}\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n#ifdef HAS_BASECOLORMAP\nvec4 baseColor = SRGBtoLINEAR(texture2D(u_BaseColorSampler, pbr_vUV)) * u_pbrMaterial.baseColorFactor;\n#else\nvec4 baseColor = u_pbrMaterial.baseColorFactor;\n#endif\n#ifdef ALPHA_CUTOFF\nif (baseColor.a < u_pbrMaterial.alphaCutoff) {\ndiscard;\n}\n#endif\nvec3 color = vec3(0, 0, 0);\nif(u_pbrMaterial.unlit){\ncolor.rgb = baseColor.rgb;\n}\nelse{\nfloat perceptualRoughness = u_pbrMaterial.metallicRoughnessValues.y;\nfloat metallic = u_pbrMaterial.metallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\nvec4 mrSample = texture2D(u_MetallicRoughnessSampler, pbr_vUV);\nperceptualRoughness = mrSample.g * perceptualRoughness;\nmetallic = mrSample.b * metallic;\n#endif\nperceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\nmetallic = clamp(metallic, 0.0, 1.0);\nfloat alphaRoughness = perceptualRoughness * perceptualRoughness;\nvec3 f0 = vec3(0.04);\nvec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\ndiffuseColor *= 1.0 - metallic;\nvec3 specularColor = mix(f0, baseColor.rgb, metallic);\nfloat reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\nfloat reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\nvec3 specularEnvironmentR0 = specularColor.rgb;\nvec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\nvec3 n = getNormal();\nvec3 v = normalize(u_Camera - pbr_vPosition);\nfloat NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\nvec3 reflection = -normalize(reflect(v, n));\nPBRInfo pbrInfo = PBRInfo(\n0.0,\nNdotV,\n0.0,\n0.0,\n0.0,\nperceptualRoughness,\nmetallic,\nspecularEnvironmentR0,\nspecularEnvironmentR90,\nalphaRoughness,\ndiffuseColor,\nspecularColor,\nn,\nv\n);\n#ifdef USE_LIGHTS\nPBRInfo_setAmbientLight(pbrInfo);\ncolor += calculateFinalColor(pbrInfo, lighting_uAmbientLight.color);\nfor(int i = 0; i < lighting_uDirectionalLightCount; i++) {\nif (i < lighting_uDirectionalLightCount) {\nPBRInfo_setDirectionalLight(pbrInfo, lighting_uDirectionalLight[i].direction);\ncolor += calculateFinalColor(pbrInfo, lighting_uDirectionalLight[i].color);\n}\n}\nfor(int i = 0; i < lighting_uPointLightCount; i++) {\nif (i < lighting_uPointLightCount) {\nPBRInfo_setPointLight(pbrInfo, lighting_uPointLight[i]);\nfloat attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));\ncolor += calculateFinalColor(pbrInfo, lighting_uPointLight[i].color / attenuation);\n}\n}\n#endif\n#ifdef USE_IBL\nif (u_pbrMateral.IBLEnabled) {\ncolor += getIBLContribution(pbrInfo, n, reflection);\n}\n#endif\n#ifdef HAS_OCCLUSIONMAP\nif (u_pbrMaterial.occlusionMapEnabled) {\nfloat ao = texture2D(u_OcclusionSampler, pbr_vUV).r;\ncolor = mix(color, color * ao, u_pbrMaterial.occlusionStrength);\n}\n#endif\n#ifdef HAS_EMISSIVEMAP\nif (u_pbrMaterial.emmissiveMapEnabled) {\nvec3 emissive = SRGBtoLINEAR(texture2D(u_EmissiveSampler, pbr_vUV)).rgb * u_pbrMaterial.emissiveFactor;\ncolor += emissive;\n}\n#endif\n#ifdef PBR_DEBUG\ncolor = mix(color, baseColor.rgb, u_pbrMaterial.scaleDiffBaseMR.y);\ncolor = mix(color, vec3(metallic), u_pbrMaterial.scaleDiffBaseMR.z);\ncolor = mix(color, vec3(perceptualRoughness), u_pbrMaterial.scaleDiffBaseMR.w);\n#endif\n}\nreturn vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lighting } from \"../lights/lighting-uniforms.js\";\nimport { vs } from \"./pbr-vertex-glsl.js\";\nimport { fs } from \"./pbr-fragment-glsl.js\";\n/**\n * An implementation of PBR (Physically-Based Rendering).\n * Physically Based Shading of a microfacet surface defined by a glTF material.\n */\nexport const pbrMaterial = {\n name: 'pbr',\n vs,\n fs,\n defines: {\n LIGHTING_FRAGMENT: 1,\n HAS_NORMALMAP: 0,\n HAS_EMISSIVEMAP: 0,\n HAS_OCCLUSIONMAP: 0,\n HAS_BASECOLORMAP: 0,\n HAS_METALROUGHNESSMAP: 0,\n ALPHA_CUTOFF: 0,\n USE_IBL: 0,\n PBR_DEBUG: 0\n },\n uniformTypes: {\n // Material is unlit\n unlit: 'i32',\n // Base color map\n baseColorMapEnabled: 'i32',\n baseColorFactor: 'vec4',\n normalMapEnabled: 'i32',\n normalScale: 'f32', // #ifdef HAS_NORMALMAP\n emissiveMapEnabled: 'i32',\n emissiveFactor: 'vec3', // #ifdef HAS_EMISSIVEMAP\n metallicRoughnessValues: 'vec2',\n metallicRoughnessMapEnabled: 'i32',\n occlusionMapEnabled: 'i32',\n occlusionStrength: 'f32', // #ifdef HAS_OCCLUSIONMAP\n alphaCutoffEnabled: 'i32',\n alphaCutoff: 'f32', // #ifdef ALPHA_CUTOFF\n // IBL\n IBLenabled: 'i32',\n scaleIBLAmbient: 'vec2', // #ifdef USE_IBL\n // debugging flags used for shader output of intermediate PBR variables\n // #ifdef PBR_DEBUG\n scaleDiffBaseMR: 'vec4',\n scaleFGDSpec: 'vec4'\n },\n dependencies: [lighting]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform brightnessContrastUniforms {\nfloat brightness;\nfloat contrast;\n} brightnessContrast;\nvec4 brightnessContrast_filterColor(vec4 color) {\ncolor.rgb += brightnessContrast.brightness;\nif (brightnessContrast.contrast > 0.0) {\ncolor.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;\n} else {\ncolor.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;\n}\nreturn color;\n}\nvec4 brightnessContrast_filterColor(vec4 color, vec2 texSize, vec2 texCoords) {\nreturn brightnessContrast_filterColor(color);\n}\n`;\n/**\n * Brightness / Contrast -\n * Provides additive brightness and multiplicative contrast control.\n * @param brightness -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)\n * @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)\n */\nexport const brightnessContrast = {\n name: 'brightnessContrast',\n uniformTypes: {\n brightness: 'f32',\n contrast: 'f32'\n },\n uniformPropTypes: {\n brightness: { format: 'f32', value: 0, min: -1, max: 1 },\n contrast: { format: 'f32', value: 0, min: -1, max: 1 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\n// Do a 9x9 bilateral box filter\nconst fs = `\\\nuniform denoiseUniforms {\nfloat strength;\n} noise;\nvec4 denoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nfloat adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);\nvec4 center = texture(source, texCoord);\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfor (float x = -4.0; x <= 4.0; x += 1.0) {\nfor (float y = -4.0; y <= 4.0; y += 1.0) {\nvec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);\nfloat weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));\nweight = pow(weight, adjustedExponent);\ncolor += offsetColor * weight;\ntotal += weight;\n}\n}\nreturn color / total;\n}\n`;\n/**\n * Denoise -\n * Smooths over grainy noise in dark images using an 9x9 box filter\n * weighted by color intensity, similar to a bilateral filter.\n */\nexport const denoise = {\n name: 'denoise',\n uniformTypes: {\n strength: 'f32'\n },\n uniformPropTypes: {\n strength: { format: 'f32', value: 0.5, min: 0, max: 1 }\n // strength: {..., adjust: (strength: number): number => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing\n },\n fs,\n passes: [{ sampler: true }, { sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform hueSaturationUniforms {\nfloat hue;\nfloat saturation;\n} hueSaturation;\nvec4 hueSaturation_filterColor(vec4 color) {\nfloat angle = hueSaturation.hue * 3.14159265;\nfloat s = sin(angle), c = cos(angle);\nvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\nfloat len = length(color.rgb);\ncolor.rgb = vec3(\ndot(color.rgb, weights.xyz),\ndot(color.rgb, weights.zxy),\ndot(color.rgb, weights.yzx)\n);\nfloat average = (color.r + color.g + color.b) / 3.0;\nif (hueSaturation.saturation > 0.0) {\ncolor.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n} else {\ncolor.rgb += (average - color.rgb) * (-hueSaturation.saturation);\n}\nreturn color;\n}\nvec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nreturn hueSaturation_filterColor(color);\n}\n`;\n/**\n * Hue / Saturation\n * Provides rotational hue and multiplicative saturation control. RGB color space\n * can be imagined as a cube where the axes are the red, green, and blue color\n * values. Hue changing works by rotating the color vector around the grayscale\n * line, which is the straight line from black (0, 0, 0) to white (1, 1, 1).\n * Saturation is implemented by scaling all color channel values either toward\n * or away from the average color channel value.\n */\nexport const hueSaturation = {\n name: 'hueSaturation',\n uniformTypes: {\n hue: 'f32',\n saturation: 'f32'\n },\n uniformPropTypes: {\n hue: { value: 0, min: -1, max: 1 },\n saturation: { value: 0, min: -1, max: 1 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform noiseUniforms {\nfloat amount;\n} noise;\nfloat rand(vec2 co) {\nreturn fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\nvec4 noise_filterColor(vec4 color, vec2 texCoord) {\nfloat diff = (rand(texCoord) - 0.5) * noise.amount;\ncolor.r += diff;\ncolor.g += diff;\ncolor.b += diff;\nreturn color;\n}\nvec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nreturn noise_filterColor(color, texCoord);\n}\n`;\n/**\n * Noise\n * Adds black and white noise to the image.\n */\nexport const noise = {\n name: 'noise',\n uniformTypes: {\n amount: 'f32'\n },\n uniformPropTypes: {\n amount: { value: 0.5, min: 0, max: 1 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform sepiaUniforms {\nfloat amount;\n} sepia;\nvec4 sepia_filterColor(vec4 color) {\nfloat r = color.r;\nfloat g = color.g;\nfloat b = color.b;\ncolor.r =\nmin(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\ncolor.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\ncolor.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\nreturn color;\n}\nvec4 sepia_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nreturn sepia_filterColor(color);\n}\n`;\n/**\n * @filter Sepia\n * @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.\n * @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)\n */\nexport const sepia = {\n name: 'sepia',\n uniformTypes: {\n amount: 'f32'\n },\n uniformPropTypes: {\n amount: { value: 0.5, min: 0, max: 1 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform vibranceUniforms {\nfloat amount;\n} vibrance;\nvec4 vibrance_filterColor(vec4 color) {\nfloat average = (color.r + color.g + color.b) / 3.0;\nfloat mx = max(color.r, max(color.g, color.b));\nfloat amt = (mx - average) * (-vibrance.amount * 3.0);\ncolor.rgb = mix(color.rgb, vec3(mx), amt);\nreturn color;\n}\nvec4 vibrance_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nreturn vibrance_filterColor(color);\n}\n`;\n/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */\nexport const vibrance = {\n name: 'vibrance',\n uniformPropTypes: {\n amount: { value: 0, min: -1, max: 1 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform vignetteUniforms {\nfloat radius;\nfloat amount;\n} vignette;\nvec4 vignette_filterColor(vec4 color, vec2 texCoord) {\nfloat dist = distance(texCoord, vec2(0.5, 0.5));\nfloat ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));\nreturn color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);\n}\nvec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nreturn vignette_filterColor(color, texCoord);\n}\n`;\n/**\n * Vignette -\n * Adds a simulated lens edge darkening effect.\n */\nexport const vignette = {\n name: 'vignette',\n fs,\n uniformTypes: {\n radius: 'f32',\n amount: 'f32'\n },\n uniformPropTypes: {\n radius: { value: 0.5, min: 0, max: 1 },\n amount: { value: 0.5, min: 0, max: 1 }\n },\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nimport { random } from \"../..//math/random/random.js\";\nconst fs = `\\\nuniform tiltShiftUniforms {\nfloat blurRadius;\nfloat gradientRadius;\nvec2 start;\nvec2 end;\nbool invert;\n} tiltShift;\nvec2 tiltShift_getDelta(vec2 texSize) {\nvec2 vector = normalize((tiltShift.end - tiltShift.start) * texSize);\nreturn tiltShift.invert ? vec2(-vector.y, vector.x) : vector;\n}\nvec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\nvec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));\nfloat radius = smoothstep(0.0, 1.0,\nabs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;\nfor (float t = -30.0; t <= 30.0; t++) {\nfloat percent = (t + offset - 0.5) / 30.0;\nfloat weight = 1.0 - abs(percent);\nvec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);\noffsetColor.rgb *= offsetColor.a;\ncolor += offsetColor * weight;\ntotal += weight;\n}\ncolor = color / total;\ncolor.rgb /= color.a + 0.00001;\nreturn color;\n}\n`;\n/**\n * Tilt Shift\n * Simulates the shallow depth of field normally encountered in close-up\n * photography, which makes the scene seem much smaller than it actually\n * is. This filter assumes the scene is relatively planar, in which case\n * the part of the scene that is completely in focus can be described by\n * a line (the intersection of the focal plane and the scene). An example\n * of a planar scene might be looking at a road from above at a downward\n * angle. The image is then blurred with a blur radius that starts at zero\n * on the line and increases further from the line.\n */\nexport const tiltShift = {\n name: 'tiltShift',\n uniformTypes: {\n blurRadius: 'f32',\n gradientRadius: 'f32',\n start: 'vec2',\n end: 'vec2',\n invert: 'i32'\n },\n uniformPropTypes: {\n blurRadius: { value: 15, min: 0, max: 50 },\n gradientRadius: { value: 200, min: 0, max: 400 },\n start: { value: [0, 0] },\n end: { value: [1, 1] },\n invert: { value: false, private: true }\n },\n passes: [\n { sampler: true, uniforms: { invert: false } },\n { sampler: true, uniforms: { invert: true } }\n ],\n dependencies: [random],\n fs\n};\n/*\nfunction tiltShift(startX, startY, endX, endY, blurRadius, gradientRadius) {\n var dx = endX - startX;\n var dy = endY - startY;\n var d = Math.sqrt(dx * dx + dy * dy);\n simpleShader.call(this, gl.tiltShift, {\n blurRadius: blurRadius,\n gradientRadius: gradientRadius,\n start: [startX, startY],\n end: [endX, endY],\n delta: [dx / d, dy / d],\n texSize: [this.width, this.height]\n });\n simpleShader.call(this, gl.tiltShift, {\n blurRadius: blurRadius,\n gradientRadius: gradientRadius,\n start: [startX, startY],\n end: [endX, endY],\n delta: [-dy / d, dx / d],\n texSize: [this.width, this.height]\n });\n\n return this;\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nimport { random } from \"../..//math/random/random.js\";\nconst fs = `\\\nuniform triangleBlurUniforms {\nfloat radius;\nvec2 delta;\n} triangleBlur;\nvec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\nfor (float t = -30.0; t <= 30.0; t++) {\nfloat percent = (t + offset - 0.5) / 30.0;\nfloat weight = 1.0 - abs(percent);\nvec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);\noffsetColor.rgb *= offsetColor.a;\ncolor += offsetColor * weight;\ntotal += weight;\n}\ncolor = color / total;\ncolor.rgb /= color.a + 0.00001;\nreturn color;\n}\n`;\n/**\n * @filter Triangle Blur\n * @description This is the most basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\nexport const triangleBlur = {\n name: 'triangleBlur',\n uniformTypes: {\n radius: 'f32',\n delta: 'vec2'\n },\n uniformPropTypes: {\n radius: { value: 20, min: 0, softMax: 100 },\n delta: { value: [1, 0], private: true }\n },\n fs,\n dependencies: [random],\n passes: [\n { sampler: true, uniforms: { delta: [1, 0] } },\n { sampler: true, uniforms: { delta: [0, 1] } }\n ]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { random } from \"../../math/random/random.js\";\nconst fs = `\nuniform zoomBlurUniforms {\n vec2 center;\n float strength;\n} zoomBlur;\n\nvec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);\n\n /* switch to pre-multiplied alpha to correctly blur transparent images */\n offsetColor.rgb *= offsetColor.a;\n\n color += offsetColor * weight;\n total += weight;\n }\n\n color = color / total;\n\n /* switch back from pre-multiplied alpha */\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n`;\n/**\n * Zoom Blur\n * Blurs the image away from a certain point, which looks like radial motion blur.\n */\nexport const zoomBlur = {\n name: 'zoomBlur',\n uniformTypes: {\n center: 'vec2',\n strength: 'f32'\n },\n uniformPropTypes: {\n center: { value: [0.5, 0.5] },\n strength: { value: 0.3, min: 0, softMax: 1 }\n },\n fs,\n dependencies: [random],\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\n// TODO pass texCoord to angle\nconst fs = `\\\nuniform colorHalftoneUniforms {\nvec2 center;\nfloat angle;\nfloat size;\n} colorHalftone;\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\nfloat s = sin(angle), c = cos(angle);\nvec2 tex = texCoord * texSize - colorHalftone.center * texSize;\nvec2 point = vec2(\nc * tex.x - s * tex.y,\ns * tex.x + c * tex.y\n) * scale;\nreturn (sin(point.x) * sin(point.y)) * 4.0;\n}\nvec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nfloat scale = 3.1514 / colorHalftone.size;\nvec3 cmy = 1.0 - color.rgb;\nfloat k = min(cmy.x, min(cmy.y, cmy.z));\ncmy = (cmy - k) / (1.0 - k);\ncmy = clamp(\ncmy * 10.0 - 3.0 + vec3(\npattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\npattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\npattern(colorHalftone.angle, scale, texSize, texCoord)\n),\n0.0,\n1.0\n);\nk = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\nreturn vec4(1.0 - cmy - k, color.a);\n}\n`;\n/**\n * Color Halftone -\n * Simulates a CMYK halftone rendering of the image by multiplying pixel values\n * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,\n * and black.\n */\nexport const colorHalftone = {\n name: 'colorHalftone',\n uniformTypes: {\n center: 'vec2',\n angle: 'f32',\n size: 'f32'\n },\n uniformPropTypes: {\n center: { value: [0.5, 0.5] },\n angle: { value: 1.1, softMin: 0, softMax: Math.PI / 2 },\n size: { value: 4, min: 1, softMin: 3, softMax: 20 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform dotScreenUniforms {\nvec2 center;\nfloat angle;\nfloat size;\n} dotScreen;\nfloat pattern(vec2 texSize, vec2 texCoord) {\nfloat scale = 3.1415 / dotScreen.size;\nfloat s = sin(dotScreen.angle), c = cos(dotScreen.angle);\nvec2 tex = texCoord * texSize - dotScreen.center * texSize;\nvec2 point = vec2(\nc * tex.x - s * tex.y,\ns * tex.x + c * tex.y\n) * scale;\nreturn (sin(point.x) * sin(point.y)) * 4.0;\n}\nvec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\nfloat average = (color.r + color.g + color.b) / 3.0;\nreturn vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n`;\n/**\n * Dot Screen -\n * Simulates a black and white halftone rendering of the image by multiplying\n * pixel values with a rotated 2D sine wave pattern.\n */\nexport const dotScreen = {\n name: 'dotScreen',\n uniformTypes: {\n center: 'vec2',\n angle: 'f32',\n size: 'f32'\n },\n uniformPropTypes: {\n center: { value: [0.5, 0.5] },\n angle: { value: 1.1, softMin: 0, softMax: Math.PI / 2 },\n size: { value: 3, min: 1, softMin: 3, softMax: 20 }\n },\n fs,\n passes: [{ filter: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nimport { random } from \"../../math/random/random.js\";\nconst fs = `\\\nuniform edgeWorkUniforms {\nfloat radius;\nvec2 delta;\n} edgeWork;\nvec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 relativeDelta = edgeWork.radius * edgeWork.delta / texSize;\nvec2 color = vec2(0.0);\nvec2 total = vec2(0.0);\nfloat offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\nfor (float t = -30.0; t <= 30.0; t++) {\nfloat percent = (t + offset - 0.5) / 30.0;\nfloat weight = 1.0 - abs(percent);\nvec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\nfloat average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\ncolor.x += average * weight;\ntotal.x += weight;\nif (abs(t) < 15.0) {\nweight = weight * 2.0 - 1.0;\ncolor.y += average * weight;\ntotal.y += weight;\n}\n}\nreturn vec4(color / total, 0.0, 1.0);\n}\nvec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 relativeDelta = edgeWork.radius * edgeWork.delta / texSize;\nvec2 color = vec2(0.0);\nvec2 total = vec2(0.0);\nfloat offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\nfor (float t = -30.0; t <= 30.0; t++) {\nfloat percent = (t + offset - 0.5) / 30.0;\nfloat weight = 1.0 - abs(percent);\nvec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\ncolor.x += sampleColor.x * weight;\ntotal.x += weight;\nif (abs(t) < 15.0) {\nweight = weight * 2.0 - 1.0;\ncolor.y += sampleColor.y * weight;\ntotal.y += weight;\n}\n}\nfloat c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\nreturn vec4(c, c, c, 1.0);\n}\n`;\n/**\n * Edge Work -\n * Picks out different frequencies in the image by subtracting two\n * copies of the image blurred with different radii.\n */\nexport const edgeWork = {\n name: 'edgeWork',\n uniformPropTypes: {\n radius: { value: 2, min: 1, softMax: 50 },\n delta: { value: [1, 0], private: true }\n },\n fs,\n dependencies: [random],\n passes: [\n {\n // @ts-expect-error\n sampler: 'edgeWork_sampleColor1',\n uniformPropTypes: { delta: [1, 0] }\n },\n {\n // @ts-expect-error\n sampler: 'edgeWork_sampleColor2',\n uniformPropTypes: { delta: [0, 1] }\n }\n ]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform hexagonalPixelateUniforms {\nvec2 center;\nfloat scale;\n} hexagonalPixelate;\nvec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\ntex.y /= 0.866025404;\ntex.x -= tex.y * 0.5;\nvec2 a;\nif (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\na = vec2(floor(tex.x), floor(tex.y));\n}\nelse a = vec2(ceil(tex.x), ceil(tex.y));\nvec2 b = vec2(ceil(tex.x), floor(tex.y));\nvec2 c = vec2(floor(tex.x), ceil(tex.y));\nvec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\nvec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\nvec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\nvec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\nfloat alen = length(TEX - A);\nfloat blen = length(TEX - B);\nfloat clen = length(TEX - C);\nvec2 choice;\nif (alen < blen) {\nif (alen < clen) choice = a;\nelse choice = c;\n} else {\nif (blen < clen) choice = b;\nelse choice = c;\n}\nchoice.x += choice.y * 0.5;\nchoice.y *= 0.866025404;\nchoice *= hexagonalPixelate.scale / texSize;\nreturn texture(source, choice + hexagonalPixelate.center);\n}\n`;\n/**\n * Hexagonal Pixelate\n * Renders the image using a pattern of hexagonal tiles. Tile colors\n * are nearest-neighbor sampled from the centers of the tiles.\n */\nexport const hexagonalPixelate = {\n name: 'hexagonalPixelate',\n uniformTypes: {\n center: 'vec2',\n scale: 'f32'\n },\n uniformPropTypes: {\n center: { value: [0.5, 0.5], hint: 'screenspace' },\n scale: { value: 10, min: 1, softMin: 5, softMax: 50 }\n },\n fs,\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform inkUniforms {\nfloat strength;\n} ink;\nvec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 dx = vec2(1.0 / texSize.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / texSize.y);\nvec4 color = texture(source, texCoord);\nfloat bigTotal = 0.0;\nfloat smallTotal = 0.0;\nvec3 bigAverage = vec3(0.0);\nvec3 smallAverage = vec3(0.0);\nfor (float x = -2.0; x <= 2.0; x += 1.0) {\nfor (float y = -2.0; y <= 2.0; y += 1.0) {\nvec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;\nbigAverage += offsetColor;\nbigTotal += 1.0;\nif (abs(x) + abs(y) < 2.0) {\nsmallAverage += offsetColor;\nsmallTotal += 1.0;\n}\n}\n}\nvec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\nfloat power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\nreturn vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n`;\n/**\n * Ink -\n * Simulates outlining the image in ink by darkening edges stronger than a\n * certain threshold. The edge detection value is the difference of two\n * copies of the image, each blurred using a blur of a different radius.\n */\nexport const ink = {\n name: 'ink',\n uniformTypes: {\n strength: 'f32'\n },\n uniformPropTypes: {\n strength: { value: 0.25, min: 0, softMax: 1 }\n },\n fs,\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nuniform magnifyUniforms {\nvec2 screenXY;\nfloat radiusPixels;\nfloat zoom;\nfloat borderWidthPixels;\nvec4 borderColor;\n} magnify;\nvec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);\nfloat dist = distance(texCoord * texSize, pos * texSize);\nif (dist < magnify.radiusPixels) {\nreturn texture(source, (texCoord - pos) / magnify.zoom + pos);\n}\nif (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {\nreturn magnify.borderColor;\n}\nreturn texture(source, texCoord);\n}\n`;\n/**\n * Magnify - display a circle with magnify effect applied to surrounding the pixels given position\n */\nexport const magnify = {\n name: 'magnify',\n uniformTypes: {\n screenXY: 'vec2',\n radiusPixels: 'f32',\n zoom: 'f32',\n borderWidthPixels: 'f32',\n borderColor: 'vec4'\n },\n uniformPropTypes: {\n // range 0 to 1\n screenXY: { value: [0, 0] },\n radiusPixels: 200,\n zoom: 2.0,\n borderWidthPixels: 0.0,\n borderColor: { value: [255, 255, 255, 255] }\n },\n fs,\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nconst fs = `\\\nvec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {\nvec4 color = texture(source, coord / texSize);\nvec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\nif (coord != clampedCoord) {\ncolor.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n}\nreturn color;\n}\n`;\nexport const warp = {\n name: 'warp',\n passes: [],\n fs\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nimport { warp } from \"./warp.js\";\nconst fs = `\\\nuniform bulgePinchUniforms {\nfloat radius;\nfloat strength;\nvec2 center;\n} bulgePinch;\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\ncoord -= texCenter;\nfloat distance = length(coord);\nif (distance < bulgePinch.radius) {\nfloat percent = distance / bulgePinch.radius;\nif (bulgePinch.strength > 0.0) {\ncoord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);\n} else {\ncoord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);\n}\n}\ncoord += texCenter;\nreturn coord;\n}\nvec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 coord = texCoord * texSize;\ncoord = bulgePinch_warp(coord, bulgePinch.center * texSize);\nreturn warp_sampleColor(source, texSize, coord);\n}\n`;\n/**\n * Bulge / Pinch -\n * Bulges or pinches the image in a circle.\n */\nexport const bulgePinch = {\n name: 'bulgePinch',\n fs,\n uniformTypes: {\n center: 'vec2',\n radius: 'f32',\n strength: 'f32'\n },\n uniformPropTypes: {\n center: { value: [0.5, 0.5] },\n radius: { value: 200, min: 1, softMax: 600 },\n strength: { value: 0.5, min: -1, max: 1 }\n },\n dependencies: [warp],\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nimport { warp } from \"./warp.js\";\nconst fs = `\\\nuniform swirlUniforms {\nfloat radius;\nfloat angle;\nvec2 center;\n} swirl;\nvec2 swirl_warp(vec2 coord, vec2 texCenter) {\ncoord -= texCenter;\nfloat distance = length(coord);\nif (distance < swirl.radius) {\nfloat percent = (swirl.radius - distance) / swirl.radius;\nfloat theta = percent * percent * swirl.angle;\nfloat s = sin(theta);\nfloat c = cos(theta);\ncoord = vec2(\ncoord.x * c - coord.y * s,\ncoord.x * s + coord.y * c\n);\n}\ncoord += texCenter;\nreturn coord;\n}\nvec4 swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\nvec2 coord = texCoord * texSize;\ncoord = swirl_warp(coord, swirl.center * texSize);\nreturn warp_sampleColor(source, texSize, coord);\n}\n`;\n/**\n * Warps a circular region of the image in a swirl.\n */\nexport const swirl = {\n name: 'swirl',\n fs,\n uniformTypes: {\n center: 'vec2',\n radius: 'f32',\n angle: 'f32'\n },\n uniformPropTypes: {\n center: { value: [0.5, 0.5] },\n radius: { value: 200, min: 1, softMax: 600 },\n angle: { value: 3, softMin: -25, softMax: 25 }\n },\n dependencies: [warp],\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * ORIGINAL LICENCE\n * @license\n * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of NVIDIA CORPORATION nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n// LUMA.GL\n// WebGL version from cesium.js, used under Apached 2.0 License\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// with the following modifications:\n// - fxaa_sampleColor to integrate with luma.gl\n// - Return color value with alpha to avoid another tap\n// - Calculate luminance in FxaaLuma\n// COMMENTS FROM CESIUM VERSION\n// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n//\n// Steps used to integrate into Cesium:\n// * The following defines are set:\n// #define FXAA_PC 1\n// #define FXAA_WEBGL_1 1\n// #define FXAA_GREEN_AS_LUMA 1\n// #define FXAA_EARLY_EXIT 1\n// #define FXAA_GLSL_120 1\n// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.\n// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace\n// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.\n// * There are no implicit conversions from ivec* to vec* so replace:\n// #define FxaaInt2 ivec2\n// with\n// #define FxaaInt2 vec2\n// * The texture2DLod function is only available in vertex shaders so replace:\n// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n// with\n// #define FxaaTexTop(t, p) texture2D(t, p)\n// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.\n// * The following parameters to FxaaPixelShader_ are unused and can be removed:\n// fxaaConsolePosPos\n// fxaaConsoleRcpFrameOpt\n// fxaaConsoleRcpFrameOpt2\n// fxaaConsole360RcpFrameOpt2\n// fxaaConsoleEdgeSharpness\n// fxaaConsoleEdgeThreshold\n// fxaaConsoleEdgeThresholdMi\n// fxaaConsole360ConstDir\n//\n// Choose the quality preset.\n// This needs to be compiled into the shader as it effects code.\n// Best option to include multiple presets is to\n// in each shader define the preset, then include this file.\n//\n// OPTIONS\n// -----------------------------------------------------------------------\n// 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n// 39 - no dither, very expensive\n//\n// NOTES\n// -----------------------------------------------------------------------\n// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n// 13 = about same speed as FXAA 3.9 and better than 12\n// 23 = closest to FXAA 3.9 visually and performance wise\n// _ = the lowest digit is directly related to performance\n// _ = the highest digit is directly related to style\n//\nconst fs = `\n#define FXAA_QUALITY_PRESET 29\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture(t, p)\n#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))\n\nFxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n\nFxaaFloat4 FxaaPixelShader_(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaTexTop(tex, posM);\n}\n\nvec4 fxaa_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n const float fxaa_QualitySubpix = 0.5;\n const float fxaa_QualityEdgeThreshold = 0.125;\n const float fxaa_QualityEdgeThresholdMin = 0.0833;\n\n return FxaaPixelShader_(\n texCoord,\n source,\n vec2(1.0) / texSize,\n fxaa_QualitySubpix,\n fxaa_QualityEdgeThreshold,\n fxaa_QualityEdgeThresholdMin\n );\n}\n`;\n/**\n * FXAA - Fast Approximate Anti-aliasing.\n */\nexport const fxaa = {\n name: 'fxaa',\n uniformPropTypes: {},\n fs,\n passes: [{ sampler: true }]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Calculate WebGL 64 bit float\n * @param a - the input float number\n * @param out - the output array. If not supplied, a new array is created.\n * @param startIndex - the index in the output array to fill from. Default 0.\n * @returns - the fp64 representation of the input number\n */\nexport function fp64ify(a, out = [], startIndex = 0) {\n const hiPart = Math.fround(a);\n const loPart = a - hiPart;\n out[startIndex] = hiPart;\n out[startIndex + 1] = loPart;\n return out;\n}\n/**\n * Calculate the low part of a WebGL 64 bit float\n * @param a the input float number\n * @returns the lower 32 bit of the number\n */\nexport function fp64LowPart(a) {\n return a - Math.fround(a);\n}\n/**\n * Calculate WebGL 64 bit matrix (transposed \"Float64Array\")\n * @param matrix the input matrix\n * @returns the fp64 representation of the input matrix\n */\nexport function fp64ifyMatrix4(matrix) {\n // Transpose the projection matrix to column major for GLSL.\n const matrixFP64 = new Float32Array(32);\n for (let i = 0; i < 4; ++i) {\n for (let j = 0; j < 4; ++j) {\n const index = i * 4 + j;\n fp64ify(matrix[j * 4 + i], matrixFP64, index * 2);\n }\n }\n return matrixFP64;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const fp64arithmeticShader = `\\\nuniform float ONE;\nvec2 split(float a) {\nconst float SPLIT = 4097.0;\nfloat t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat a_hi = t * ONE - (t - a);\nfloat a_lo = a * ONE - a_hi;\n#else\nfloat a_hi = t - (t - a);\nfloat a_lo = a - a_hi;\n#endif\nreturn vec2(a_hi, a_lo);\n}\nvec2 split2(vec2 a) {\nvec2 b = split(a.x);\nb.y += a.y;\nreturn b;\n}\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat sum = (a + b) * ONE;\nfloat err = b - (sum - a) * ONE;\n#else\nfloat sum = a + b;\nfloat err = b - (sum - a);\n#endif\nreturn vec2(sum, err);\n}\nvec2 twoSum(float a, float b) {\nfloat s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat v = (s * ONE - a) * ONE;\nfloat err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\nfloat v = s - a;\nfloat err = (a - (s - v)) + (b - v);\n#endif\nreturn vec2(s, err);\n}\nvec2 twoSub(float a, float b) {\nfloat s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat v = (s * ONE - a) * ONE;\nfloat err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\nfloat v = s - a;\nfloat err = (a - (s - v)) - (b + v);\n#endif\nreturn vec2(s, err);\n}\nvec2 twoSqr(float a) {\nfloat prod = a * a;\nvec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\na_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\nfloat err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\nreturn vec2(prod, err);\n}\nvec2 twoProd(float a, float b) {\nfloat prod = a * b;\nvec2 a_fp64 = split(a);\nvec2 b_fp64 = split(b);\nfloat err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\na_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\nreturn vec2(prod, err);\n}\nvec2 sum_fp64(vec2 a, vec2 b) {\nvec2 s, t;\ns = twoSum(a.x, b.x);\nt = twoSum(a.y, b.y);\ns.y += t.x;\ns = quickTwoSum(s.x, s.y);\ns.y += t.y;\ns = quickTwoSum(s.x, s.y);\nreturn s;\n}\nvec2 sub_fp64(vec2 a, vec2 b) {\nvec2 s, t;\ns = twoSub(a.x, b.x);\nt = twoSub(a.y, b.y);\ns.y += t.x;\ns = quickTwoSum(s.x, s.y);\ns.y += t.y;\ns = quickTwoSum(s.x, s.y);\nreturn s;\n}\nvec2 mul_fp64(vec2 a, vec2 b) {\nvec2 prod = twoProd(a.x, b.x);\nprod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nprod = split2(prod);\n#endif\nprod = quickTwoSum(prod.x, prod.y);\nprod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nprod = split2(prod);\n#endif\nprod = quickTwoSum(prod.x, prod.y);\nreturn prod;\n}\nvec2 div_fp64(vec2 a, vec2 b) {\nfloat xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nvec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\nvec2 yn = a * xn;\n#endif\nfloat diff = (sub_fp64(a, mul_fp64(b, yn))).x;\nvec2 prod = twoProd(xn, diff);\nreturn sum_fp64(yn, prod);\n}\nvec2 sqrt_fp64(vec2 a) {\nif (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\nif (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\nfloat x = 1.0 / sqrt(a.x);\nfloat yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nvec2 yn_sqr = twoSqr(yn) * ONE;\n#else\nvec2 yn_sqr = twoSqr(yn);\n#endif\nfloat diff = sub_fp64(a, yn_sqr).x;\nvec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nreturn sum_fp64(split(yn), prod);\n#else\nreturn sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const fp64functionShader = `\\\nconst vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);\nconst vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);\nconst vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);\nconst vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);\nconst vec2 PI_2_FP64 = vec2(1.5707963705062866, -4.371139006309477e-8);\nconst vec2 PI_4_FP64 = vec2(0.7853981852531433, -2.1855695031547384e-8);\nconst vec2 PI_16_FP64 = vec2(0.19634954631328583, -5.463923757886846e-9);\nconst vec2 PI_16_2_FP64 = vec2(0.39269909262657166, -1.0927847515773692e-8);\nconst vec2 PI_16_3_FP64 = vec2(0.5890486240386963, -1.4906100798128818e-9);\nconst vec2 PI_180_FP64 = vec2(0.01745329238474369, 1.3519960498364902e-10);\nconst vec2 SIN_TABLE_0_FP64 = vec2(0.19509032368659973, -1.6704714833615242e-9);\nconst vec2 SIN_TABLE_1_FP64 = vec2(0.3826834261417389, 6.22335089017767e-9);\nconst vec2 SIN_TABLE_2_FP64 = vec2(0.5555702447891235, -1.1769521357507529e-8);\nconst vec2 SIN_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617041793133e-8);\nconst vec2 COS_TABLE_0_FP64 = vec2(0.9807852506637573, 2.9739473106360492e-8);\nconst vec2 COS_TABLE_1_FP64 = vec2(0.9238795042037964, 2.8307490351764386e-8);\nconst vec2 COS_TABLE_2_FP64 = vec2(0.8314695954322815, 1.6870263741530778e-8);\nconst vec2 COS_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617152815436e-8);\nconst vec2 INVERSE_FACTORIAL_3_FP64 = vec2(1.666666716337204e-01, -4.967053879312289e-09);\nconst vec2 INVERSE_FACTORIAL_4_FP64 = vec2(4.16666679084301e-02, -1.2417634698280722e-09);\nconst vec2 INVERSE_FACTORIAL_5_FP64 = vec2(8.333333767950535e-03, -4.34617203337595e-10);\nconst vec2 INVERSE_FACTORIAL_6_FP64 = vec2(1.3888889225199819e-03, -3.3631094437103215e-11);\nconst vec2 INVERSE_FACTORIAL_7_FP64 = vec2(1.9841270113829523e-04, -2.725596874933456e-12);\nconst vec2 INVERSE_FACTORIAL_8_FP64 = vec2(2.4801587642286904e-05, -3.406996025904184e-13);\nconst vec2 INVERSE_FACTORIAL_9_FP64 = vec2(2.75573188446287533e-06, 3.7935713937038186e-14);\nconst vec2 INVERSE_FACTORIAL_10_FP64 = vec2(2.755731998149713e-07, -7.575112367869873e-15);\nfloat nint(float d) {\nif (d == floor(d)) return d;\nreturn floor(d + 0.5);\n}\nvec2 nint_fp64(vec2 a) {\nfloat hi = nint(a.x);\nfloat lo;\nvec2 tmp;\nif (hi == a.x) {\nlo = nint(a.y);\ntmp = quickTwoSum(hi, lo);\n} else {\nlo = 0.0;\nif (abs(hi - a.x) == 0.5 && a.y < 0.0) {\nhi -= 1.0;\n}\ntmp = vec2(hi, lo);\n}\nreturn tmp;\n}\nvec2 exp_fp64(vec2 a) {\nconst int k_power = 4;\nconst float k = 16.0;\nconst float inv_k = 1.0 / k;\nif (a.x <= -88.0) return vec2(0.0, 0.0);\nif (a.x >= 88.0) return vec2(1.0 / 0.0, 1.0 / 0.0);\nif (a.x == 0.0 && a.y == 0.0) return vec2(1.0, 0.0);\nif (a.x == 1.0 && a.y == 0.0) return E_FP64;\nfloat m = floor(a.x / LOG2_FP64.x + 0.5);\nvec2 r = sub_fp64(a, mul_fp64(LOG2_FP64, vec2(m, 0.0))) * inv_k;\nvec2 s, t, p;\np = mul_fp64(r, r);\ns = sum_fp64(r, p * 0.5);\np = mul_fp64(p, r);\nt = mul_fp64(p, INVERSE_FACTORIAL_3_FP64);\ns = sum_fp64(s, t);\np = mul_fp64(p, r);\nt = mul_fp64(p, INVERSE_FACTORIAL_4_FP64);\ns = sum_fp64(s, t);\np = mul_fp64(p, r);\nt = mul_fp64(p, INVERSE_FACTORIAL_5_FP64);\ns = sum_fp64(s, t);\nfor (int i = 0; i < k_power; i++) {\ns = sum_fp64(s * 2.0, mul_fp64(s, s));\n}\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\ns = sum_fp64(s, vec2(ONE, 0.0));\n#else\ns = sum_fp64(s, vec2(1.0, 0.0));\n#endif\nreturn s * pow(2.0, m);\n}\nvec2 log_fp64(vec2 a)\n{\nif (a.x == 1.0 && a.y == 0.0) return vec2(0.0, 0.0);\nif (a.x <= 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\nvec2 x = vec2(log(a.x), 0.0);\nvec2 s;\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\ns = vec2(ONE, 0.0);\n#else\ns = vec2(1.0, 0.0);\n#endif\nx = sub_fp64(sum_fp64(x, mul_fp64(a, exp_fp64(-x))), s);\nreturn x;\n}\nvec2 sin_taylor_fp64(vec2 a) {\nvec2 r, s, t, x;\nif (a.x == 0.0 && a.y == 0.0) {\nreturn vec2(0.0, 0.0);\n}\nx = -mul_fp64(a, a);\ns = a;\nr = a;\nr = mul_fp64(r, x);\nt = mul_fp64(r, INVERSE_FACTORIAL_3_FP64);\ns = sum_fp64(s, t);\nr = mul_fp64(r, x);\nt = mul_fp64(r, INVERSE_FACTORIAL_5_FP64);\ns = sum_fp64(s, t);\nreturn s;\n}\nvec2 cos_taylor_fp64(vec2 a) {\nvec2 r, s, t, x;\nif (a.x == 0.0 && a.y == 0.0) {\nreturn vec2(1.0, 0.0);\n}\nx = -mul_fp64(a, a);\nr = x;\ns = sum_fp64(vec2(1.0, 0.0), r * 0.5);\nr = mul_fp64(r, x);\nt = mul_fp64(r, INVERSE_FACTORIAL_4_FP64);\ns = sum_fp64(s, t);\nr = mul_fp64(r, x);\nt = mul_fp64(r, INVERSE_FACTORIAL_6_FP64);\ns = sum_fp64(s, t);\nreturn s;\n}\nvoid sincos_taylor_fp64(vec2 a, out vec2 sin_t, out vec2 cos_t) {\nif (a.x == 0.0 && a.y == 0.0) {\nsin_t = vec2(0.0, 0.0);\ncos_t = vec2(1.0, 0.0);\n}\nsin_t = sin_taylor_fp64(a);\ncos_t = sqrt_fp64(sub_fp64(vec2(1.0, 0.0), mul_fp64(sin_t, sin_t)));\n}\nvec2 sin_fp64(vec2 a) {\nif (a.x == 0.0 && a.y == 0.0) {\nreturn vec2(0.0, 0.0);\n}\nvec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\nvec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\nvec2 t;\nfloat q = floor(r.x / PI_2_FP64.x + 0.5);\nint j = int(q);\nif (j < -2 || j > 2) {\nreturn vec2(0.0 / 0.0, 0.0 / 0.0);\n}\nt = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\nq = floor(t.x / PI_16_FP64.x + 0.5);\nint k = int(q);\nif (k == 0) {\nif (j == 0) {\nreturn sin_taylor_fp64(t);\n} else if (j == 1) {\nreturn cos_taylor_fp64(t);\n} else if (j == -1) {\nreturn -cos_taylor_fp64(t);\n} else {\nreturn -sin_taylor_fp64(t);\n}\n}\nint abs_k = int(abs(float(k)));\nif (abs_k > 4) {\nreturn vec2(0.0 / 0.0, 0.0 / 0.0);\n} else {\nt = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n}\nvec2 u = vec2(0.0, 0.0);\nvec2 v = vec2(0.0, 0.0);\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\nif (abs(float(abs_k) - 1.0) < 0.5) {\nu = COS_TABLE_0_FP64;\nv = SIN_TABLE_0_FP64;\n} else if (abs(float(abs_k) - 2.0) < 0.5) {\nu = COS_TABLE_1_FP64;\nv = SIN_TABLE_1_FP64;\n} else if (abs(float(abs_k) - 3.0) < 0.5) {\nu = COS_TABLE_2_FP64;\nv = SIN_TABLE_2_FP64;\n} else if (abs(float(abs_k) - 4.0) < 0.5) {\nu = COS_TABLE_3_FP64;\nv = SIN_TABLE_3_FP64;\n}\n#else\nif (abs_k == 1) {\nu = COS_TABLE_0_FP64;\nv = SIN_TABLE_0_FP64;\n} else if (abs_k == 2) {\nu = COS_TABLE_1_FP64;\nv = SIN_TABLE_1_FP64;\n} else if (abs_k == 3) {\nu = COS_TABLE_2_FP64;\nv = SIN_TABLE_2_FP64;\n} else if (abs_k == 4) {\nu = COS_TABLE_3_FP64;\nv = SIN_TABLE_3_FP64;\n}\n#endif\nvec2 sin_t, cos_t;\nsincos_taylor_fp64(t, sin_t, cos_t);\nvec2 result = vec2(0.0, 0.0);\nif (j == 0) {\nif (k > 0) {\nresult = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n} else {\nresult = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n}\n} else if (j == 1) {\nif (k > 0) {\nresult = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n} else {\nresult = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n}\n} else if (j == -1) {\nif (k > 0) {\nresult = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n} else {\nresult = -sum_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n}\n} else {\nif (k > 0) {\nresult = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n} else {\nresult = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));\n}\n}\nreturn result;\n}\nvec2 cos_fp64(vec2 a) {\nif (a.x == 0.0 && a.y == 0.0) {\nreturn vec2(1.0, 0.0);\n}\nvec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\nvec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\nvec2 t;\nfloat q = floor(r.x / PI_2_FP64.x + 0.5);\nint j = int(q);\nif (j < -2 || j > 2) {\nreturn vec2(0.0 / 0.0, 0.0 / 0.0);\n}\nt = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\nq = floor(t.x / PI_16_FP64.x + 0.5);\nint k = int(q);\nif (k == 0) {\nif (j == 0) {\nreturn cos_taylor_fp64(t);\n} else if (j == 1) {\nreturn -sin_taylor_fp64(t);\n} else if (j == -1) {\nreturn sin_taylor_fp64(t);\n} else {\nreturn -cos_taylor_fp64(t);\n}\n}\nint abs_k = int(abs(float(k)));\nif (abs_k > 4) {\nreturn vec2(0.0 / 0.0, 0.0 / 0.0);\n} else {\nt = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n}\nvec2 u = vec2(0.0, 0.0);\nvec2 v = vec2(0.0, 0.0);\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\nif (abs(float(abs_k) - 1.0) < 0.5) {\nu = COS_TABLE_0_FP64;\nv = SIN_TABLE_0_FP64;\n} else if (abs(float(abs_k) - 2.0) < 0.5) {\nu = COS_TABLE_1_FP64;\nv = SIN_TABLE_1_FP64;\n} else if (abs(float(abs_k) - 3.0) < 0.5) {\nu = COS_TABLE_2_FP64;\nv = SIN_TABLE_2_FP64;\n} else if (abs(float(abs_k) - 4.0) < 0.5) {\nu = COS_TABLE_3_FP64;\nv = SIN_TABLE_3_FP64;\n}\n#else\nif (abs_k == 1) {\nu = COS_TABLE_0_FP64;\nv = SIN_TABLE_0_FP64;\n} else if (abs_k == 2) {\nu = COS_TABLE_1_FP64;\nv = SIN_TABLE_1_FP64;\n} else if (abs_k == 3) {\nu = COS_TABLE_2_FP64;\nv = SIN_TABLE_2_FP64;\n} else if (abs_k == 4) {\nu = COS_TABLE_3_FP64;\nv = SIN_TABLE_3_FP64;\n}\n#endif\nvec2 sin_t, cos_t;\nsincos_taylor_fp64(t, sin_t, cos_t);\nvec2 result = vec2(0.0, 0.0);\nif (j == 0) {\nif (k > 0) {\nresult = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n} else {\nresult = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n}\n} else if (j == 1) {\nif (k > 0) {\nresult = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n} else {\nresult = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));\n}\n} else if (j == -1) {\nif (k > 0) {\nresult = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n} else {\nresult = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n}\n} else {\nif (k > 0) {\nresult = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n} else {\nresult = -sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n}\n}\nreturn result;\n}\nvec2 tan_fp64(vec2 a) {\nvec2 sin_a;\nvec2 cos_a;\nif (a.x == 0.0 && a.y == 0.0) {\nreturn vec2(0.0, 0.0);\n}\nvec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\nvec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\nvec2 t;\nfloat q = floor(r.x / PI_2_FP64.x + 0.5);\nint j = int(q);\nif (j < -2 || j > 2) {\nreturn vec2(0.0 / 0.0, 0.0 / 0.0);\n}\nt = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\nq = floor(t.x / PI_16_FP64.x + 0.5);\nint k = int(q);\nint abs_k = int(abs(float(k)));\nif (abs_k > 4) {\nreturn vec2(0.0 / 0.0, 0.0 / 0.0);\n} else {\nt = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n}\nvec2 u = vec2(0.0, 0.0);\nvec2 v = vec2(0.0, 0.0);\nvec2 sin_t, cos_t;\nvec2 s, c;\nsincos_taylor_fp64(t, sin_t, cos_t);\nif (k == 0) {\ns = sin_t;\nc = cos_t;\n} else {\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\nif (abs(float(abs_k) - 1.0) < 0.5) {\nu = COS_TABLE_0_FP64;\nv = SIN_TABLE_0_FP64;\n} else if (abs(float(abs_k) - 2.0) < 0.5) {\nu = COS_TABLE_1_FP64;\nv = SIN_TABLE_1_FP64;\n} else if (abs(float(abs_k) - 3.0) < 0.5) {\nu = COS_TABLE_2_FP64;\nv = SIN_TABLE_2_FP64;\n} else if (abs(float(abs_k) - 4.0) < 0.5) {\nu = COS_TABLE_3_FP64;\nv = SIN_TABLE_3_FP64;\n}\n#else\nif (abs_k == 1) {\nu = COS_TABLE_0_FP64;\nv = SIN_TABLE_0_FP64;\n} else if (abs_k == 2) {\nu = COS_TABLE_1_FP64;\nv = SIN_TABLE_1_FP64;\n} else if (abs_k == 3) {\nu = COS_TABLE_2_FP64;\nv = SIN_TABLE_2_FP64;\n} else if (abs_k == 4) {\nu = COS_TABLE_3_FP64;\nv = SIN_TABLE_3_FP64;\n}\n#endif\nif (k > 0) {\ns = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\nc = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n} else {\ns = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\nc = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n}\n}\nif (j == 0) {\nsin_a = s;\ncos_a = c;\n} else if (j == 1) {\nsin_a = c;\ncos_a = -s;\n} else if (j == -1) {\nsin_a = -c;\ncos_a = s;\n} else {\nsin_a = -s;\ncos_a = -c;\n}\nreturn div_fp64(sin_a, cos_a);\n}\nvec2 radians_fp64(vec2 degree) {\nreturn mul_fp64(degree, PI_180_FP64);\n}\nvec2 mix_fp64(vec2 a, vec2 b, float x) {\nvec2 range = sub_fp64(b, a);\nreturn sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));\n}\nvoid vec2_sum_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\nout_val[0] = sum_fp64(a[0], b[0]);\nout_val[1] = sum_fp64(a[1], b[1]);\n}\nvoid vec2_sub_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\nout_val[0] = sub_fp64(a[0], b[0]);\nout_val[1] = sub_fp64(a[1], b[1]);\n}\nvoid vec2_mul_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\nout_val[0] = mul_fp64(a[0], b[0]);\nout_val[1] = mul_fp64(a[1], b[1]);\n}\nvoid vec2_div_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\nout_val[0] = div_fp64(a[0], b[0]);\nout_val[1] = div_fp64(a[1], b[1]);\n}\nvoid vec2_mix_fp64(vec2 x[2], vec2 y[2], float a, out vec2 out_val[2]) {\nvec2 range[2];\nvec2_sub_fp64(y, x, range);\nvec2 portion[2];\nportion[0] = range[0] * a;\nportion[1] = range[1] * a;\nvec2_sum_fp64(x, portion, out_val);\n}\nvec2 vec2_length_fp64(vec2 x[2]) {\nreturn sqrt_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])));\n}\nvoid vec2_normalize_fp64(vec2 x[2], out vec2 out_val[2]) {\nvec2 length = vec2_length_fp64(x);\nvec2 length_vec2[2];\nlength_vec2[0] = length;\nlength_vec2[1] = length;\nvec2_div_fp64(x, length_vec2, out_val);\n}\nvec2 vec2_distance_fp64(vec2 x[2], vec2 y[2]) {\nvec2 diff[2];\nvec2_sub_fp64(x, y, diff);\nreturn vec2_length_fp64(diff);\n}\nvec2 vec2_dot_fp64(vec2 a[2], vec2 b[2]) {\nvec2 v[2];\nv[0] = mul_fp64(a[0], b[0]);\nv[1] = mul_fp64(a[1], b[1]);\nreturn sum_fp64(v[0], v[1]);\n}\nvoid vec3_sub_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {\nfor (int i = 0; i < 3; i++) {\nout_val[i] = sum_fp64(a[i], b[i]);\n}\n}\nvoid vec3_sum_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {\nfor (int i = 0; i < 3; i++) {\nout_val[i] = sum_fp64(a[i], b[i]);\n}\n}\nvec2 vec3_length_fp64(vec2 x[3]) {\nreturn sqrt_fp64(sum_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])),\nmul_fp64(x[2], x[2])));\n}\nvec2 vec3_distance_fp64(vec2 x[3], vec2 y[3]) {\nvec2 diff[3];\nvec3_sub_fp64(x, y, diff);\nreturn vec3_length_fp64(diff);\n}\nvoid vec4_fp64(vec4 a, out vec2 out_val[4]) {\nout_val[0].x = a[0];\nout_val[0].y = 0.0;\nout_val[1].x = a[1];\nout_val[1].y = 0.0;\nout_val[2].x = a[2];\nout_val[2].y = 0.0;\nout_val[3].x = a[3];\nout_val[3].y = 0.0;\n}\nvoid vec4_scalar_mul_fp64(vec2 a[4], vec2 b, out vec2 out_val[4]) {\nout_val[0] = mul_fp64(a[0], b);\nout_val[1] = mul_fp64(a[1], b);\nout_val[2] = mul_fp64(a[2], b);\nout_val[3] = mul_fp64(a[3], b);\n}\nvoid vec4_sum_fp64(vec2 a[4], vec2 b[4], out vec2 out_val[4]) {\nfor (int i = 0; i < 4; i++) {\nout_val[i] = sum_fp64(a[i], b[i]);\n}\n}\nvoid vec4_dot_fp64(vec2 a[4], vec2 b[4], out vec2 out_val) {\nvec2 v[4];\nv[0] = mul_fp64(a[0], b[0]);\nv[1] = mul_fp64(a[1], b[1]);\nv[2] = mul_fp64(a[2], b[2]);\nv[3] = mul_fp64(a[3], b[3]);\nout_val = sum_fp64(sum_fp64(v[0], v[1]), sum_fp64(v[2], v[3]));\n}\nvoid mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {\nvec2 tmp[4];\nfor (int i = 0; i < 4; i++)\n{\nfor (int j = 0; j < 4; j++)\n{\ntmp[j] = b[j + i * 4];\n}\nvec4_dot_fp64(a, tmp, out_val[i]);\n}\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { fp64ify, fp64LowPart, fp64ifyMatrix4 } from \"./fp64-utils.js\";\nimport { fp64arithmeticShader } from \"./fp64-arithmetic-glsl.js\";\nimport { fp64functionShader } from \"./fp64-functions-glsl.js\";\nconst CONST_UNIFORMS = {\n // Used in LUMA_FP64_CODE_ELIMINATION_WORKAROUND\n ONE: 1.0\n};\nexport { fp64ify, fp64LowPart, fp64ifyMatrix4 };\nfunction getUniforms() {\n return CONST_UNIFORMS;\n}\n/**\n * 64bit arithmetic: add, sub, mul, div (small subset of fp64 module)\n */\nexport const fp64arithmetic = {\n name: 'fp64-arithmetic',\n vs: fp64arithmeticShader,\n getUniforms,\n fp64ify,\n fp64LowPart,\n fp64ifyMatrix4\n};\n/**\n * Full 64 bit math library\n */\nexport const fp64 = {\n name: 'fp64',\n vs: fp64functionShader,\n dependencies: [fp64arithmetic],\n // Additional Functions\n fp64ify,\n fp64LowPart,\n fp64ifyMatrix4\n};\n", "// import {ShaderModule} from '../../types';\nimport { glsl } from \"../../lib/glsl-utils/highlight.js\";\n// TODO - reuse normal from geometry module\nconst vs = `\\\nvarying vec4 geometry_vPosition;\nvarying vec3 geometry_vNormal;\nvoid geometry_setNormal(vec3 normal) {\ngeometry_vNormal = normal;\n}\nvoid geometry_setPosition(vec4 position) {\ngeometry_vPosition = position;\n}\nvoid geometry_setPosition(vec3 position) {\ngeometry_vPosition = vec4(position, 1.);\n}\n`;\nconst fs = `\\\nvarying vec4 geometry_vPosition;\nvarying vec3 geometry_vNormal;\nvec4 geometry_getPosition() {\nreturn geometry_vPosition;\n}\nvec3 geometry_getNormal() {\nreturn geometry_vNormal;\n}\n`;\n/**\n * Geometry varyings\n */\nexport const geometry = {\n name: 'geometry',\n vs,\n fs\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Matrix4 } from '@math.gl/core';\nimport { glsl } from \"../../lib/glsl-utils/highlight.js\";\nconst IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\nconst DEFAULT_MODULE_OPTIONS = {\n modelMatrix: IDENTITY_MATRIX,\n viewMatrix: IDENTITY_MATRIX,\n projectionMatrix: IDENTITY_MATRIX,\n cameraPositionWorld: [0, 0, 0]\n};\nfunction getUniforms(opts = DEFAULT_MODULE_OPTIONS, prevUniforms = {}) {\n // const viewProjectionInverse = viewProjection.invert();\n // viewInverseMatrix: view.invert(),\n // viewProjectionInverseMatrix: viewProjectionInverse\n const uniforms = {};\n if (opts.modelMatrix !== undefined) {\n uniforms.modelMatrix = opts.modelMatrix;\n }\n if (opts.viewMatrix !== undefined) {\n uniforms.viewMatrix = opts.viewMatrix;\n }\n if (opts.projectionMatrix !== undefined) {\n uniforms.projectionMatrix = opts.projectionMatrix;\n }\n if (opts.cameraPositionWorld !== undefined) {\n uniforms.cameraPositionWorld = opts.cameraPositionWorld;\n }\n // COMPOSITE UNIFORMS\n if (opts.projectionMatrix !== undefined || opts.viewMatrix !== undefined) {\n uniforms.viewProjectionMatrix = new Matrix4(opts.projectionMatrix).multiplyRight(opts.viewMatrix);\n }\n return uniforms;\n}\nconst common = `\\\nvarying vec4 project_vPositionWorld;\nvarying vec3 project_vNormalWorld;\nvec4 project_getPosition_World() {\nreturn project_vPositionWorld;\n}\nvec3 project_getNormal_World() {\nreturn project_vNormalWorld;\n}\n`;\nconst vs = `\\\n${common}\n\n// Unprefixed uniforms\nuniform mat4 modelMatrix;\nuniform mat4 viewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewProjectionMatrix;\nuniform vec3 cameraPositionWorld;\n\nstruct World {\n vec3 position;\n vec3 normal;\n};\n\nWorld world;\n\nvoid project_setPosition(vec4 position) {\n project_vPositionWorld = position;\n}\n\nvoid project_setNormal(vec3 normal) {\n project_vNormalWorld = normal;\n}\n\nvoid project_setPositionAndNormal_World(vec3 position, vec3 normal) {\n world.position = position;\n world.normal = normal;\n}\n\nvoid project_setPositionAndNormal_Model(vec3 position, vec3 normal) {\n world.position = (modelMatrix * vec4(position, 1.)).xyz;\n world.normal = mat3(modelMatrix) * normal;\n}\n\nvec4 project_model_to_clipspace(vec4 position) {\n return viewProjectionMatrix * modelMatrix * position;\n}\n\nvec4 project_model_to_clipspace(vec3 position) {\n return viewProjectionMatrix * modelMatrix * vec4(position, 1.);\n}\n\nvec4 project_world_to_clipspace(vec3 position) {\n return viewProjectionMatrix * vec4(position, 1.);\n}\n\nvec4 project_view_to_clipspace(vec3 position) {\n return projectionMatrix * vec4(position, 1.);\n}\n\nvec4 project_to_clipspace(vec3 position) {\n return viewProjectionMatrix * vec4(position, 1.);\n}\n`;\nconst fs = `\n${common}\\\n`;\n/**\n * Projects coordinates\n */\nexport const project = {\n name: 'project',\n getUniforms,\n vs,\n fs\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const lightingShader = `\\\n#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\nstruct AmbientLight {\nvec3 color;\n};\nstruct PointLight {\nvec3 color;\nvec3 position;\nvec3 attenuation;\n};\nstruct DirectionalLight {\nvec3 color;\nvec3 direction;\n};\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\nuniform bool lighting_uEnabled;\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\nreturn pointLight.attenuation.x\n+ pointLight.attenuation.y * distance\n+ pointLight.attenuation.z * distance * distance;\n}\n#endif\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lightingShader } from \"./lights-glsl.js\";\nconst INITIAL_MODULE_OPTIONS = {\n lightSources: {}\n};\n// Take color 0-255 and intensity as input and output 0.0-1.0 range\nfunction convertColor(colorDef = {}) {\n const { color = [0, 0, 0], intensity = 1.0 } = colorDef;\n return color.map(component => (component * intensity) / 255.0);\n}\nfunction getLightSourceUniforms({ ambientLight, pointLights = [], directionalLights = [] }) {\n const lightSourceUniforms = {};\n if (ambientLight) {\n lightSourceUniforms['lighting_uAmbientLight.color'] = convertColor(ambientLight);\n }\n else {\n lightSourceUniforms['lighting_uAmbientLight.color'] = [0, 0, 0];\n }\n pointLights.forEach((pointLight, index) => {\n lightSourceUniforms[`lighting_uPointLight[${index}].color`] = convertColor(pointLight);\n lightSourceUniforms[`lighting_uPointLight[${index}].position`] = pointLight.position;\n lightSourceUniforms[`lighting_uPointLight[${index}].attenuation`] = pointLight.attenuation || [\n 1, 0, 0\n ];\n });\n lightSourceUniforms.lighting_uPointLightCount = pointLights.length;\n directionalLights.forEach((directionalLight, index) => {\n lightSourceUniforms[`lighting_uDirectionalLight[${index}].color`] =\n convertColor(directionalLight);\n lightSourceUniforms[`lighting_uDirectionalLight[${index}].direction`] =\n directionalLight.direction;\n });\n lightSourceUniforms.lighting_uDirectionalLightCount = directionalLights.length;\n return lightSourceUniforms;\n}\n// eslint-disable-next-line complexity\nfunction getUniforms(opts = INITIAL_MODULE_OPTIONS) {\n // Specify lights separately\n if ('lightSources' in opts) {\n const { ambientLight, pointLights, directionalLights } = opts.lightSources || {};\n const hasLights = ambientLight ||\n (pointLights && pointLights.length > 0) ||\n (directionalLights && directionalLights.length > 0);\n if (!hasLights) {\n return { lighting_uEnabled: false };\n }\n return Object.assign({}, getLightSourceUniforms({ ambientLight, pointLights, directionalLights }), {\n lighting_uEnabled: true\n });\n }\n // Support for array of lights. Type of light is detected by type field\n if ('lights' in opts) {\n const lightSources = { pointLights: [], directionalLights: [] };\n // @ts-expect-error\n for (const light of opts.lights || []) {\n switch (light.type) {\n case 'ambient':\n // Note: Only uses last ambient light\n // TODO - add ambient light sources on CPU?\n lightSources.ambientLight = light;\n break;\n case 'directional':\n lightSources.directionalLights?.push(light);\n break;\n case 'point':\n lightSources.pointLights?.push(light);\n break;\n default:\n // eslint-disable-next-line\n // console.warn(light.type);\n }\n }\n // Call the `opts.lightSources`` version\n return getUniforms({ lightSources });\n }\n return {};\n}\n/**\n * An implementation of PBR (Physically-Based Rendering).\n * Physically Based Shading of a microfacet surface defined by a glTF material.\n */\nexport const lights = {\n name: 'lights',\n vs: lightingShader,\n fs: lightingShader,\n getUniforms,\n defines: {\n MAX_LIGHTS: 3\n }\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nimport { project } from \"../../project/project.js\";\nconst DEFAULT_MODULE_OPTIONS = {\n lightDirection: new Float32Array([1, 1, 2])\n};\nfunction getUniforms(opts = DEFAULT_MODULE_OPTIONS) {\n const uniforms = {};\n if (opts.lightDirection) {\n // @ts-expect-error TODO add types\n uniforms.dirlight_uLightDirection = opts.lightDirection;\n }\n return uniforms;\n}\nconst fs = `\\\nuniform vec3 dirlight_uLightDirection;\nvec4 dirlight_filterColor(vec4 color) {\nvec3 normal = project_getNormal_World();\nfloat d = abs(dot(normalize(normal), normalize(dirlight_uLightDirection)));\nreturn vec4(color.rgb * d, color.a);\n}\n`;\n/**\n * Cheap lighting - single directional light, single dot product, one uniform\n */\nexport const dirlight = {\n name: 'dirlight',\n // vs // TODO - reuse normal from geometry module\n fs,\n getUniforms,\n dependencies: [project]\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const lightingShader = `\\\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\nvec3 halfway_direction = normalize(light_direction + view_direction);\nfloat lambertian = dot(light_direction, normal_worldspace);\nfloat specular = 0.0;\nif (lambertian > 0.0) {\nfloat specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\nspecular = pow(specular_angle, lighting_uShininess);\n}\nlambertian = max(lambertian, 0.0);\nreturn (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\nvec3 lightColor = surfaceColor;\nif (lighting_uEnabled) {\nvec3 view_direction = normalize(cameraPosition - position_worldspace);\nlightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uPointLightCount) {\nbreak;\n}\nPointLight pointLight = lighting_uPointLight[i];\nvec3 light_position_worldspace = pointLight.position;\nvec3 light_direction = normalize(light_position_worldspace - position_worldspace);\nlightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n}\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uDirectionalLightCount) {\nbreak;\n}\nDirectionalLight directionalLight = lighting_uDirectionalLight[i];\nlightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n}\n}\nreturn lightColor;\n}\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\nvec3 lightColor = vec3(0, 0, 0);\nvec3 surfaceColor = vec3(0, 0, 0);\nif (lighting_uEnabled) {\nvec3 view_direction = normalize(cameraPosition - position_worldspace);\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uPointLightCount) {\nbreak;\n}\nPointLight pointLight = lighting_uPointLight[i];\nvec3 light_position_worldspace = pointLight.position;\nvec3 light_direction = normalize(light_position_worldspace - position_worldspace);\nlightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n}\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uDirectionalLightCount) {\nbreak;\n}\nDirectionalLight directionalLight = lighting_uDirectionalLight[i];\nlightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n}\n}\nreturn lightColor;\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lights } from \"../lights/lights.js\";\nimport { lightingShader } from \"./phong-lighting-glsl.js\";\nconst INITIAL_MODULE_OPTIONS = {};\nfunction getMaterialUniforms(material) {\n const { ambient = 0.35, diffuse = 0.6, shininess = 32, specularColor = [30, 30, 30] } = material;\n return {\n lighting_uAmbient: ambient,\n lighting_uDiffuse: diffuse,\n lighting_uShininess: shininess,\n lighting_uSpecularColor: specularColor.map(x => x / 255)\n };\n}\nfunction getUniforms(opts = INITIAL_MODULE_OPTIONS) {\n if (!('material' in opts)) {\n return {};\n }\n const { material } = opts;\n if (!material) {\n return { lighting_uEnabled: false };\n }\n return getMaterialUniforms(material);\n}\nexport const gouraudLighting = {\n name: 'gouraud-lighting',\n dependencies: [lights],\n vs: lightingShader,\n defines: {\n LIGHTING_VERTEX: 1\n },\n getUniforms\n};\nexport const phongLighting = {\n name: 'phong-lighting',\n dependencies: [lights],\n fs: lightingShader,\n defines: {\n LIGHTING_FRAGMENT: 1\n },\n getUniforms\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const vs = `\\\nuniform mat4 u_MVPMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_NormalMatrix;\nout vec3 pbr_vPosition;\nout vec2 pbr_vUV;\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nout mat3 pbr_vTBN;\n# else\nout vec3 pbr_vNormal;\n# endif\n#endif\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\nvec4 pos = u_ModelMatrix * position;\npbr_vPosition = vec3(pos.xyz) / pos.w;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));\nvec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));\nvec3 bitangentW = cross(normalW, tangentW) * tangent.w;\npbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else\npbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n#ifdef HAS_UV\npbr_vUV = uv;\n#else\npbr_vUV = vec2(0.,0.);\n#endif\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Attribution:\n// MIT license, Copyright (c) 2016-2017 Mohamad Moneimne and Contributors\n// This fragment shader defines a reference implementation for Physically Based Shading of\n// a microfacet surface material defined by a glTF model.\n//\n// TODO - better do the checks outside of shader\nimport { glsl } from \"../../../lib/glsl-utils/highlight.js\";\nexport const fs = `\\\nprecision highp float;\nuniform bool pbr_uUnlit;\n#ifdef USE_IBL\nuniform samplerCube u_DiffuseEnvSampler;\nuniform samplerCube u_SpecularEnvSampler;\nuniform sampler2D u_brdfLUT;\nuniform vec2 u_ScaleIBLAmbient;\n#endif\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D u_BaseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D u_NormalSampler;\nuniform float u_NormalScale;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D u_EmissiveSampler;\nuniform vec3 u_EmissiveFactor;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D u_MetallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D u_OcclusionSampler;\nuniform float u_OcclusionStrength;\n#endif\n#ifdef ALPHA_CUTOFF\nuniform float u_AlphaCutoff;\n#endif\nuniform vec2 u_MetallicRoughnessValues;\nuniform vec4 u_BaseColorFactor;\nuniform vec3 u_Camera;\n#ifdef PBR_DEBUG\nuniform vec4 u_ScaleDiffBaseMR;\nuniform vec4 u_ScaleFGDSpec;\n#endif\nin vec3 pbr_vPosition;\nin vec2 pbr_vUV;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nin mat3 pbr_vTBN;\n#else\nin vec3 pbr_vNormal;\n#endif\n#endif\nstruct PBRInfo\n{\nfloat NdotL;\nfloat NdotV;\nfloat NdotH;\nfloat LdotH;\nfloat VdotH;\nfloat perceptualRoughness;\nfloat metalness;\nvec3 reflectance0;\nvec3 reflectance90;\nfloat alphaRoughness;\nvec3 diffuseColor;\nvec3 specularColor;\nvec3 n;\nvec3 v;\n};\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\nvec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n#else\nvec3 bLess = step(vec3(0.04045),srgbIn.xyz);\nvec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif\nreturn vec4(linOut,srgbIn.w);;\n#else\nreturn srgbIn;\n#endif\n}\nvec3 getNormal()\n{\n#ifndef HAS_TANGENTS\nvec3 pos_dx = dFdx(pbr_vPosition);\nvec3 pos_dy = dFdy(pbr_vPosition);\nvec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\nvec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\nvec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n#ifdef HAS_NORMALS\nvec3 ng = normalize(pbr_vNormal);\n#else\nvec3 ng = cross(pos_dx, pos_dy);\n#endif\nt = normalize(t - ng * dot(ng, t));\nvec3 b = normalize(cross(ng, t));\nmat3 tbn = mat3(t, b, ng);\n#else\nmat3 tbn = pbr_vTBN;\n#endif\n#ifdef HAS_NORMALMAP\nvec3 n = texture(u_NormalSampler, pbr_vUV).rgb;\nn = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));\n#else\nvec3 n = normalize(tbn[2].xyz);\n#endif\nreturn n;\n}\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)\n{\nfloat mipCount = 9.0;\nfloat lod = (pbrInputs.perceptualRoughness * mipCount);\nvec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,\nvec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;\nvec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;\n#ifdef USE_TEX_LOD\nvec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;\n#else\nvec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;\n#endif\nvec3 diffuse = diffuseLight * pbrInputs.diffuseColor;\nvec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);\ndiffuse *= u_ScaleIBLAmbient.x;\nspecular *= u_ScaleIBLAmbient.y;\nreturn diffuse + specular;\n}\n#endif\nvec3 diffuse(PBRInfo pbrInputs)\n{\nreturn pbrInputs.diffuseColor / M_PI;\n}\nvec3 specularReflection(PBRInfo pbrInputs)\n{\nreturn pbrInputs.reflectance0 +\n(pbrInputs.reflectance90 - pbrInputs.reflectance0) *\npow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);\n}\nfloat geometricOcclusion(PBRInfo pbrInputs)\n{\nfloat NdotL = pbrInputs.NdotL;\nfloat NdotV = pbrInputs.NdotV;\nfloat r = pbrInputs.alphaRoughness;\nfloat attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\nfloat attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\nreturn attenuationL * attenuationV;\n}\nfloat microfacetDistribution(PBRInfo pbrInputs)\n{\nfloat roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;\nfloat f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;\nreturn roughnessSq / (M_PI * f * f);\n}\nvoid PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {\npbrInputs.NdotL = 1.0;\npbrInputs.NdotH = 0.0;\npbrInputs.LdotH = 0.0;\npbrInputs.VdotH = 1.0;\n}\nvoid PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {\nvec3 n = pbrInputs.n;\nvec3 v = pbrInputs.v;\nvec3 l = normalize(lightDirection);\nvec3 h = normalize(l+v);\npbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);\npbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);\npbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);\npbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\nvoid PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {\nvec3 light_direction = normalize(pointLight.position - pbr_vPosition);\nPBRInfo_setDirectionalLight(pbrInputs, light_direction);\n}\nvec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {\nvec3 F = specularReflection(pbrInputs);\nfloat G = geometricOcclusion(pbrInputs);\nfloat D = microfacetDistribution(pbrInputs);\nvec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);\nvec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);\nreturn pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);\n}\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n#ifdef HAS_BASECOLORMAP\nvec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;\n#else\nvec4 baseColor = u_BaseColorFactor;\n#endif\n#ifdef ALPHA_CUTOFF\nif (baseColor.a < u_AlphaCutoff) {\ndiscard;\n}\n#endif\nvec3 color = vec3(0, 0, 0);\nif(pbr_uUnlit){\ncolor.rgb = baseColor.rgb;\n}\nelse{\nfloat perceptualRoughness = u_MetallicRoughnessValues.y;\nfloat metallic = u_MetallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\nvec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);\nperceptualRoughness = mrSample.g * perceptualRoughness;\nmetallic = mrSample.b * metallic;\n#endif\nperceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\nmetallic = clamp(metallic, 0.0, 1.0);\nfloat alphaRoughness = perceptualRoughness * perceptualRoughness;\nvec3 f0 = vec3(0.04);\nvec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\ndiffuseColor *= 1.0 - metallic;\nvec3 specularColor = mix(f0, baseColor.rgb, metallic);\nfloat reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\nfloat reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\nvec3 specularEnvironmentR0 = specularColor.rgb;\nvec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\nvec3 n = getNormal();\nvec3 v = normalize(u_Camera - pbr_vPosition);\nfloat NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\nvec3 reflection = -normalize(reflect(v, n));\nPBRInfo pbrInputs = PBRInfo(\n0.0,\nNdotV,\n0.0,\n0.0,\n0.0,\nperceptualRoughness,\nmetallic,\nspecularEnvironmentR0,\nspecularEnvironmentR90,\nalphaRoughness,\ndiffuseColor,\nspecularColor,\nn,\nv\n);\n#ifdef USE_LIGHTS\nPBRInfo_setAmbientLight(pbrInputs);\ncolor += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);\nfor(int i = 0; i < lighting_uDirectionalLightCount; i++) {\nif (i < lighting_uDirectionalLightCount) {\nPBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);\ncolor += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);\n}\n}\nfor(int i = 0; i < lighting_uPointLightCount; i++) {\nif (i < lighting_uPointLightCount) {\nPBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);\nfloat attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));\ncolor += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);\n}\n}\n#endif\n#ifdef USE_IBL\ncolor += getIBLContribution(pbrInputs, n, reflection);\n#endif\n#ifdef HAS_OCCLUSIONMAP\nfloat ao = texture(u_OcclusionSampler, pbr_vUV).r;\ncolor = mix(color, color * ao, u_OcclusionStrength);\n#endif\n#ifdef HAS_EMISSIVEMAP\nvec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;\ncolor += emissive;\n#endif\n#ifdef PBR_DEBUG\ncolor = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);\ncolor = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);\ncolor = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);\n#endif\n}\nreturn vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n`;\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { lights } from \"../lights/lights.js\";\nimport { vs } from \"./pbr-vertex-glsl.js\";\nimport { fs } from \"./pbr-fragment-glsl.js\";\n/**\n * An implementation of PBR (Physically-Based Rendering).\n * Physically Based Shading of a microfacet surface defined by a glTF material.\n */\nexport const pbr = {\n name: 'pbr',\n vs,\n fs,\n defines: {\n LIGHTING_FRAGMENT: 1\n },\n dependencies: [lights]\n};\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,OAAO,CAAC,MAAM,GAAG;;;ACHvB,SAAS,OAAO,WAAW,SAAS;AACvC,MAAI,CAAC,WAAW;AACZ,UAAM,IAAI,MAAM,WAAW,gCAAgC;AAAA,EAC/D;AACJ;;;ACJA,IAAM,0BAA0B;AAAA,EAC5B,QAAQ;AAAA,IACJ,MAAM;AAAA,IACN,SAAS,OAAO,UAAU;AACtB,aAAQ,OAAO,SAAS,KAAK,KACzB,OAAO,aAAa,aACnB,SAAS,QAAQ,UAAa,SAAS,SAAS,SAChD,SAAS,QAAQ,UAAa,SAAS,SAAS;AAAA,IACzD;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,OAAO,UAAU;AACtB,aAAO,MAAM,QAAQ,KAAK,KAAK,YAAY,OAAO,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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAX,IAAM,MAAM;AAAA,EACf,MAAM;AAAA,EACN,IAAAC;AAAA,EACA,IAAAC;AAAA,EACA,SAAS;AAAA,IACL,mBAAmB;AAAA,EACvB;AAAA,EACA,cAAc,CAAC,MAAM;AACzB;", "names": ["dirlight", "module", "vs", "fs", "getUniforms", "log", "vs", "fs", "module", "vs", "fs", "log", "module", "getUniforms", "module", "module", "module", "glsl", "module", "module", "fs", "import_core", "LIGHT_TYPE", "getUniforms", "lights", "getUniforms", "vs", "fs", "vs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "fs", "index", "getUniforms", "vs", "fs", "import_core", "getUniforms", "vs", "fs", "convertColor", "getLightSourceUniforms", "index", "getUniforms", "DEFAULT_MODULE_OPTIONS", "getUniforms", "fs", "dirlight", "lightingShader", "INITIAL_MODULE_OPTIONS", "getUniforms", "lightingShader", "vs", "fs", "vs", "fs"] }