@luma.gl/shadertools
Advanced tools
Comparing version 9.0.0-alpha.47 to 9.0.0-alpha.48
@@ -28,3 +28,3 @@ /** | ||
export { picking } from './modules/engine/picking/picking'; | ||
export type { LightingModuleProps, LightingModuleProps as Lighting } from './modules/lighting/lights/lighting-uniforms'; | ||
export type { LightingProps } from './modules/lighting/lights/lighting-uniforms'; | ||
export { lighting } from './modules/lighting/lights/lighting-uniforms'; | ||
@@ -79,3 +79,2 @@ export { dirlight } from './modules/lighting/no-material/dirlight'; | ||
export { project as project1 } from './modules-webgl1/project/project'; | ||
export { picking as picking1 } from './modules-webgl1/picking/picking'; | ||
export { lights as lights1 } from './modules-webgl1/lighting/lights/lights'; | ||
@@ -82,0 +81,0 @@ export { dirlight as dirlight1 } from './modules-webgl1/lighting/dirlight/dirlight'; |
@@ -46,3 +46,2 @@ export { glsl } from "./lib/glsl-utils/highlight.js"; | ||
export { project as project1 } from "./modules-webgl1/project/project.js"; | ||
export { picking as picking1 } from "./modules-webgl1/picking/picking.js"; | ||
export { lights as lights1 } from "./modules-webgl1/lighting/lights/lights.js"; | ||
@@ -49,0 +48,0 @@ export { dirlight as dirlight1 } from "./modules-webgl1/lighting/dirlight/dirlight.js"; |
@@ -18,9 +18,12 @@ export function getShaderInfo(source, defaultName) { | ||
if (words && words.length >= 2 && words[0] === '#version') { | ||
const v = parseInt(words[1], 10); | ||
if (Number.isFinite(v)) { | ||
version = v; | ||
const parsedVersion = parseInt(words[1], 10); | ||
if (Number.isFinite(parsedVersion)) { | ||
version = parsedVersion; | ||
} | ||
} | ||
if (version !== 100 && version !== 300) { | ||
throw new Error(`Invalid GLSL version ${version}`); | ||
} | ||
return version; | ||
} | ||
//# sourceMappingURL=get-shader-info.js.map |
import type { ShaderModule } from './shader-module/shader-module'; | ||
import type { PlatformInfo } from './shader-assembly/platform-info'; | ||
import { ShaderModuleInstance } from './shader-module/shader-module-instance'; | ||
import { GetUniformsFunc } from './shader-assembly/assemble-shaders'; | ||
import { AssembleShaderProps } from './shader-assembly/select-shaders'; | ||
@@ -41,6 +41,7 @@ /** | ||
*/ | ||
assembleShaders(platformInfo: PlatformInfo, props: AssembleShaderProps): { | ||
assembleShaders(props: AssembleShaderProps): { | ||
vs: string; | ||
fs: string; | ||
getUniforms: import("./shader-assembly/assemble-shaders").GetUniformsFunc; | ||
getUniforms: GetUniformsFunc; | ||
modules: ShaderModuleInstance[]; | ||
}; | ||
@@ -50,4 +51,4 @@ /** | ||
*/ | ||
_getModuleList(appModules?: (ShaderModule | ShaderModuleInstance)[]): (ShaderModule | ShaderModuleInstance)[]; | ||
_getModuleList(appModules?: (ShaderModule | ShaderModuleInstance)[]): ShaderModuleInstance[]; | ||
} | ||
//# sourceMappingURL=shader-assembler.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { ShaderModuleInstance } from "./shader-module/shader-module-instance.js"; | ||
import { assembleShaders } from "./shader-assembly/assemble-shaders.js"; | ||
@@ -29,7 +30,8 @@ import { selectShaders } from "./shader-assembly/select-shaders.js"; | ||
} | ||
assembleShaders(platformInfo, props) { | ||
assembleShaders(props) { | ||
const modules = this._getModuleList(props.modules); | ||
const hookFunctions = this._hookFunctions; | ||
const options = selectShaders(platformInfo, props); | ||
const assembled = assembleShaders(platformInfo, { | ||
const options = selectShaders(props); | ||
const assembled = assembleShaders({ | ||
platformInfo: props.platformInfo, | ||
...options, | ||
@@ -39,3 +41,6 @@ modules, | ||
}); | ||
return assembled; | ||
return { | ||
...assembled, | ||
modules | ||
}; | ||
} | ||
@@ -62,3 +67,3 @@ _getModuleList() { | ||
modules.length = count; | ||
return modules; | ||
return ShaderModuleInstance.instantiateModules(modules); | ||
} | ||
@@ -65,0 +70,0 @@ } |
@@ -15,2 +15,4 @@ import { PlatformInfo } from './platform-info'; | ||
export type AssembleShaderOptions = { | ||
/** information about the platform (which shader language & version, extensions etc.) */ | ||
platformInfo: PlatformInfo; | ||
/** Inject shader id #defines */ | ||
@@ -31,4 +33,2 @@ id?: string; | ||
inject?: Record<string, string | ShaderInjection>; | ||
/** Whether to transpile code */ | ||
transpileToGLSL100?: boolean; | ||
/** Whether to inject prologue */ | ||
@@ -46,3 +46,3 @@ prologue?: boolean; | ||
*/ | ||
export declare function assembleShaders(platformInfo: PlatformInfo, options: AssembleShaderOptions): { | ||
export declare function assembleShaders(options: AssembleShaderOptions): { | ||
vs: string; | ||
@@ -49,0 +49,0 @@ fs: string; |
@@ -6,10 +6,10 @@ import { glsl } from "../glsl-utils/highlight.js"; | ||
import { transpileGLSLShader } from "../shader-transpiler/transpile-glsl-shader.js"; | ||
import { normalizeShaderHooks, getShaderHooks } from "./shader-hooks.js"; | ||
import { assert } from "../utils/assert.js"; | ||
import { normalizeShaderHooks, getShaderHooks } from "./shader-hooks.js"; | ||
const INJECT_SHADER_DECLARATIONS = `\n\n${DECLARATION_INJECT_MARKER}\n\n`; | ||
import { getShaderInfo } from "../glsl-utils/get-shader-info.js"; | ||
const INJECT_SHADER_DECLARATIONS = `\n\n${DECLARATION_INJECT_MARKER}\n`; | ||
const FRAGMENT_SHADER_PROLOGUE = glsl`\ | ||
precision highp float; | ||
`; | ||
export function assembleShaders(platformInfo, options) { | ||
export function assembleShaders(options) { | ||
const { | ||
@@ -20,6 +20,6 @@ vs, | ||
const modules = resolveModules(options.modules || []); | ||
switch (platformInfo.shaderLanguage) { | ||
switch (options.platformInfo.shaderLanguage) { | ||
case 'glsl': | ||
return { | ||
vs: assembleGLSLShader(platformInfo, { | ||
vs: assembleGLSLShader(options.platformInfo, { | ||
...options, | ||
@@ -30,3 +30,3 @@ source: vs, | ||
}), | ||
fs: assembleGLSLShader(platformInfo, { | ||
fs: assembleGLSLShader(options.platformInfo, { | ||
...options, | ||
@@ -41,3 +41,3 @@ source: fs, | ||
return { | ||
vs: assembleWGSLShader(platformInfo, { | ||
vs: assembleWGSLShader(options.platformInfo, { | ||
...options, | ||
@@ -48,3 +48,3 @@ source: vs, | ||
}), | ||
fs: assembleWGSLShader(platformInfo, { | ||
fs: assembleWGSLShader(options.platformInfo, { | ||
...options, | ||
@@ -131,3 +131,2 @@ source: fs, | ||
function assembleGLSLShader(platformInfo, options) { | ||
const isWGSL = options.source.includes('->'); | ||
const { | ||
@@ -137,3 +136,3 @@ id, | ||
stage, | ||
language = isWGSL ? 'wgsl' : 'glsl', | ||
language = 'glsl', | ||
modules, | ||
@@ -143,19 +142,11 @@ defines = {}, | ||
inject = {}, | ||
transpileToGLSL100 = false, | ||
prologue = !isWGSL, | ||
prologue = true, | ||
log | ||
} = options; | ||
assert(typeof source === 'string', 'shader source must be a string'); | ||
const sourceVersion = language === 'glsl' ? getShaderInfo(source).version : -1; | ||
const targetVersion = platformInfo.shaderLanguageVersion; | ||
const sourceVersionDirective = sourceVersion === 100 ? '#version 100' : '#version 300 es'; | ||
const sourceLines = source.split('\n'); | ||
let glslVersion = 100; | ||
let versionLine = ''; | ||
let coreSource = source; | ||
if (sourceLines[0].indexOf('#version ') === 0) { | ||
glslVersion = 300; | ||
versionLine = sourceLines[0]; | ||
coreSource = sourceLines.slice(1).join('\n'); | ||
} else { | ||
versionLine = `#version ${glslVersion}`; | ||
} | ||
const targetVersion = transpileToGLSL100 ? 100 : glslVersion; | ||
const coreSource = sourceLines.slice(1).join('\n'); | ||
const allDefines = {}; | ||
@@ -172,3 +163,5 @@ modules.forEach(module => { | ||
assembledSource = prologue ? `\ | ||
${versionLine} | ||
${sourceVersionDirective} | ||
// ----- PROLOGUE ------------------------- | ||
${getShaderNameDefine({ | ||
@@ -182,5 +175,9 @@ id, | ||
${getVersionDefines(platformInfo)} | ||
${stage === 'fragment' ? FRAGMENT_SHADER_PROLOGUE : ''} | ||
// ----- APPLICATION DEFINES ------------------------- | ||
${getApplicationDefines(allDefines)} | ||
${stage === 'fragment' ? FRAGMENT_SHADER_PROLOGUE : ''} | ||
` : `${versionLine} | ||
` : `${sourceVersionDirective} | ||
`; | ||
@@ -235,2 +232,3 @@ break; | ||
} | ||
assembledSource += '// ----- MAIN SHADER SOURCE -------------------------'; | ||
assembledSource += INJECT_SHADER_DECLARATIONS; | ||
@@ -241,3 +239,5 @@ assembledSource = injectShader(assembledSource, stage, declInjections); | ||
assembledSource = injectShader(assembledSource, stage, mainInjections); | ||
assembledSource = transpileGLSLShader(assembledSource, targetVersion, stage); | ||
if (language === 'glsl' && sourceVersion !== targetVersion) { | ||
assembledSource = transpileGLSLShader(assembledSource, targetVersion, stage); | ||
} | ||
return assembledSource.trim(); | ||
@@ -269,9 +269,4 @@ } | ||
let defines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
let count = 0; | ||
let sourceText = ''; | ||
for (const define in defines) { | ||
if (count === 0) { | ||
sourceText += '\n// APPLICATION DEFINES\n'; | ||
} | ||
count++; | ||
const value = defines[define]; | ||
@@ -282,7 +277,4 @@ if (value || Number.isFinite(value)) { | ||
} | ||
if (count === 0) { | ||
sourceText += '\n'; | ||
} | ||
return sourceText; | ||
} | ||
//# sourceMappingURL=assemble-shaders.js.map |
@@ -46,4 +46,5 @@ import { glsl } from "../glsl-utils/highlight.js"; | ||
export function getVersionDefines(platformInfo) { | ||
let versionDefines = glsl`\ | ||
#if (__VERSION__ > 120) | ||
let versionDefines = ''; | ||
if (platformInfo.features.has('webgl2')) { | ||
versionDefines += glsl`\ | ||
# define FEATURE_GLSL_DERIVATIVES | ||
@@ -53,8 +54,9 @@ # define FEATURE_GLSL_DRAW_BUFFERS | ||
# define FEATURE_GLSL_TEXTURE_LOD | ||
#endif // __VERSION | ||
`; | ||
if (!platformInfo.features.has('webgl2') && platformInfo.features.has('glsl-frag-depth')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (!platformInfo.features.has('webgl2')) { | ||
if (platformInfo.features.has('glsl-frag-depth')) { | ||
versionDefines += glsl`\ | ||
// FRAG_DEPTH => gl_FragDepth is available | ||
// FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available | ||
#ifdef GL_EXT_frag_depth | ||
@@ -67,27 +69,25 @@ # extension GL_EXT_frag_depth : enable | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo !== null && platformInfo !== void 0 && platformInfo.features.has('glsl-derivatives')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (platformInfo !== null && platformInfo !== void 0 && platformInfo.features.has('glsl-derivatives')) { | ||
versionDefines += glsl`\ | ||
// DERIVATIVES => dxdF, dxdY and fwidth are available | ||
// FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available | ||
#if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES) | ||
# extension GL_OES_standard_derivatives : enable | ||
# define FEATURE_GLSL_DERIVATIVES | ||
# define DERIVATIVES | ||
#endif | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo !== null && platformInfo !== void 0 && platformInfo.features.has('glsl-frag-data')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (platformInfo !== null && platformInfo !== void 0 && platformInfo.features.has('glsl-frag-data')) { | ||
versionDefines += glsl`\ | ||
// DRAW_BUFFERS => gl_FragData[] is available | ||
// FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available | ||
#ifdef GL_EXT_draw_buffers | ||
# extension GL_EXT_draw_buffers : require | ||
# define FEATURE_GLSL_DRAW_BUFFERS | ||
# define DRAW_BUFFERS | ||
#endif | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo !== null && platformInfo !== void 0 && platformInfo.features.has('glsl-texture-lod')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (platformInfo !== null && platformInfo !== void 0 && platformInfo.features.has('glsl-texture-lod')) { | ||
versionDefines += glsl`\ | ||
// TEXTURE_LOD => texture2DLod etc are available | ||
@@ -100,2 +100,3 @@ #ifdef GL_EXT_shader_texture_lod | ||
`; | ||
} | ||
} | ||
@@ -102,0 +103,0 @@ return versionDefines; |
@@ -11,2 +11,4 @@ /** | ||
shaderLanguage: 'glsl' | 'wgsl'; | ||
/** Which shader language version is preferred */ | ||
shaderLanguageVersion: 100 | 300; | ||
/** string identifying current GPU */ | ||
@@ -13,0 +15,0 @@ gpu: string; |
import type { ShaderModule } from '../shader-module/shader-module'; | ||
import { ShaderModuleInstance } from '../shader-module/shader-module-instance'; | ||
/** | ||
* Instantiate shader modules and esolve any dependencies | ||
*/ | ||
export declare function resolveModules(modules: (ShaderModule | ShaderModuleInstance)[]): ShaderModuleInstance[]; | ||
@@ -4,0 +7,0 @@ /** |
@@ -7,2 +7,3 @@ import type { PlatformInfo } from './platform-info'; | ||
export type AssembleShaderProps = Omit<AssembleShaderOptions, 'vs' | 'fs'> & { | ||
platformInfo: PlatformInfo; | ||
/** Vertex shader source. Can be GLSL or WGSL or both */ | ||
@@ -25,3 +26,3 @@ vs?: { | ||
*/ | ||
export declare function selectShaders(platformInfo: PlatformInfo, props: AssembleShaderProps): AssembleShaderOptions; | ||
export declare function selectShaders(props: AssembleShaderProps): AssembleShaderOptions; | ||
//# sourceMappingURL=select-shaders.d.ts.map |
@@ -1,9 +0,9 @@ | ||
export function selectShaders(platformInfo, props) { | ||
export function selectShaders(props) { | ||
if (!props.vs) { | ||
throw new Error('no vertex shader'); | ||
} | ||
const vs = getShaderSource(platformInfo, props.vs); | ||
const vs = getShaderSource(props.platformInfo, props.vs); | ||
let fs; | ||
if (props.fs) { | ||
fs = getShaderSource(platformInfo, props.fs); | ||
fs = getShaderSource(props.platformInfo, props.fs); | ||
} | ||
@@ -10,0 +10,0 @@ return { |
@@ -7,3 +7,3 @@ import { ShaderModule } from '../shader-module/shader-module'; | ||
/** Generates shader code for a module */ | ||
export declare function generateShaderForModule(module: ShaderModule, options: ShaderGenerationOptions): string; | ||
export declare function generateShaderForModule(module: ShaderModule<Record<string, unknown>>, options: ShaderGenerationOptions): string; | ||
//# sourceMappingURL=generate-shader.d.ts.map |
@@ -1,2 +0,3 @@ | ||
export declare function normalizeShaderModule(module: any): any; | ||
import { ShaderModule } from './shader-module'; | ||
export declare function normalizeShaderModule(module: ShaderModule): ShaderModule; | ||
//# sourceMappingURL=normalize-shader-module.d.ts.map |
import { assert } from "../utils/assert.js"; | ||
import { makePropValidators, getValidatedProperties } from "../filters/prop-types.js"; | ||
import { normalizeInjections } from "../shader-assembly/shader-injections.js"; | ||
let index = 1; | ||
export class ShaderModuleInstance { | ||
@@ -11,3 +12,6 @@ static instantiateModules(modules) { | ||
assert(typeof module !== 'string', `Shader module use by name is deprecated. Import shader module '${module}' and use it directly.`); | ||
assert(module.name, 'shader module has no name'); | ||
if (!module.name) { | ||
console.warn('shader module has no name'); | ||
module.name = `shader-module-${index++}`; | ||
} | ||
const moduleObject = new ShaderModuleInstance(module); | ||
@@ -65,7 +69,10 @@ moduleObject.dependencies = ShaderModuleInstance.instantiateModules(module.dependencies || []); | ||
} | ||
const moduleName = this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_'); | ||
return `\ | ||
#define MODULE_${this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_')} | ||
// ----- MODULE ${this.name} --------------- | ||
#define MODULE_${moduleName} | ||
${moduleSource}\ | ||
// END MODULE_${this.name} | ||
`; | ||
@@ -72,0 +79,0 @@ } |
@@ -12,9 +12,11 @@ import { NumberArray } from '@math.gl/types'; | ||
*/ | ||
export type ShaderModule<UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, SettingsT extends Record<string, unknown> = UniformsT, BindingsT extends Record<string, unknown> = {}> = { | ||
export type ShaderModule<PropsT extends Record<string, unknown> = Record<string, unknown>, UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, BindingsT extends Record<string, unknown> = {}> = { | ||
/** Used for type inference not for values */ | ||
props?: Required<PropsT>; | ||
/** Used for type inference, not currently used for values */ | ||
uniforms?: UniformsT; | ||
name: string; | ||
fs?: string; | ||
vs?: string; | ||
/** Used for type inference, not currently used for values */ | ||
uniforms?: UniformsT; | ||
/** Uniform shader types */ | ||
/** Uniform shader types @note: Both order and types MUST match uniform block declarations in shader */ | ||
uniformTypes?: Record<keyof UniformsT, UniformFormat>; | ||
@@ -26,3 +28,3 @@ /** Uniform JS prop types */ | ||
/** Function that maps settings to uniforms */ | ||
getUniforms?: (settings: Partial<SettingsT>, prevUniforms?: any) => UniformsT; | ||
getUniforms?: (settings?: any, prevUniforms?: any) => Record<string, UniformValue>; | ||
/** uniform buffers, textures, samplers, storage, ... */ | ||
@@ -39,5 +41,7 @@ bindings?: Record<keyof BindingsT, { | ||
}>; | ||
dependencies?: ShaderModule[]; | ||
dependencies?: ShaderModule<any, any>[]; | ||
/** Information on deprecated properties */ | ||
deprecations?: ShaderModuleDeprecation[]; | ||
/** Internal */ | ||
normalized?: boolean; | ||
}; | ||
@@ -44,0 +48,0 @@ /** Use to generate deprecations when shader module is used */ |
@@ -6,3 +6,3 @@ import type { ShaderModule, UniformValue } from './shader-module'; | ||
*/ | ||
export type ShaderPass<UniformsT extends Record<string, UniformValue>> = ShaderModule<UniformsT> & { | ||
export type ShaderPass<PropsT extends Record<string, unknown>, UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>> = ShaderModule<PropsT, UniformsT> & { | ||
passes?: ShaderPassData[]; | ||
@@ -9,0 +9,0 @@ }; |
/** | ||
* Transpiles shader source code to target GLSL version | ||
* Transpiles GLSL 3.00 shader source code to target GLSL version (3.00 or 1.00) | ||
* | ||
* @note We always run transpiler even if same version e.g. 3.00 => 3.00 | ||
* @note For texture sampling transpilation, apps need to use non-standard texture* calls in GLSL 3.00 source | ||
* RFC: https://github.com/visgl/luma.gl/blob/7.0-release/dev-docs/RFCs/v6.0/portable-glsl-300-rfc.md | ||
*/ | ||
export declare function transpileGLSLShader(source: string, targetGLSLVersion: number, stage: 'vertex' | 'fragment'): string; | ||
export declare function transpileGLSLShader(source: string, targetGLSLVersion: 100 | 300, stage: 'vertex' | 'fragment'): string; | ||
//# sourceMappingURL=transpile-glsl-shader.d.ts.map |
export function transpileGLSLShader(source, targetGLSLVersion, stage) { | ||
var _source$match; | ||
const sourceGLSLVersion = Number(((_source$match = source.match(/^#version[ \t]+(\d+)/m)) === null || _source$match === void 0 ? void 0 : _source$match[1]) || 100); | ||
if (sourceGLSLVersion !== 300) { | ||
throw new Error('luma.gl v9 only supports GLSL 3.00 shader sources'); | ||
} | ||
switch (targetGLSLVersion) { | ||
@@ -6,7 +11,9 @@ case 300: | ||
case 'vertex': | ||
return convertShader(source, ES300_VERTEX_REPLACEMENTS); | ||
source = convertShader(source, ES300_VERTEX_REPLACEMENTS); | ||
return source; | ||
case 'fragment': | ||
return convertFragmentShaderTo300(source); | ||
source = convertShader(source, ES300_FRAGMENT_REPLACEMENTS); | ||
return source; | ||
default: | ||
throw new Error(`unknown shader stage ${stage}`); | ||
throw new Error(stage); | ||
} | ||
@@ -16,10 +23,13 @@ case 100: | ||
case 'vertex': | ||
return convertShader(source, ES100_VERTEX_REPLACEMENTS); | ||
source = convertShader(source, ES100_VERTEX_REPLACEMENTS); | ||
return source; | ||
case 'fragment': | ||
return convertFragmentShaderTo100(source); | ||
source = convertShader(source, ES100_FRAGMENT_REPLACEMENTS); | ||
source = convertFragmentShaderTo100(source); | ||
return source; | ||
default: | ||
throw new Error(`unknown shader stage ${stage}`); | ||
throw new Error(stage); | ||
} | ||
default: | ||
throw new Error(`unknown GLSL version ${targetGLSLVersion}`); | ||
throw new Error(String(targetGLSLVersion)); | ||
} | ||
@@ -35,3 +45,2 @@ } | ||
const ES300_FRAGMENT_OUTPUT_REGEX = /\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/; | ||
const REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/; | ||
function convertShader(source, replacements) { | ||
@@ -43,14 +52,2 @@ for (const [pattern, replacement] of replacements) { | ||
} | ||
function convertFragmentShaderTo300(source) { | ||
source = convertShader(source, ES300_FRAGMENT_REPLACEMENTS); | ||
const outputMatch = ES300_FRAGMENT_OUTPUT_REGEX.exec(source); | ||
if (outputMatch) { | ||
const outputName = outputMatch[1]; | ||
source = source.replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName); | ||
} else { | ||
const outputName = 'fragmentColor'; | ||
source = source.replace(REGEX_START_OF_MAIN, match => `out vec4 ${outputName};\n${match}`).replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName); | ||
} | ||
return source; | ||
} | ||
function convertFragmentShaderTo100(source) { | ||
@@ -57,0 +54,0 @@ source = convertShader(source, ES100_FRAGMENT_REPLACEMENTS); |
import { ShaderModule } from '../..'; | ||
type ProjectionProps = { | ||
modelMatrix?: readonly number[]; | ||
viewMatrix?: readonly number[]; | ||
projectionMatrix?: readonly number[]; | ||
cameraPositionWorld?: readonly number[]; | ||
}; | ||
/** | ||
* Projects coordinates | ||
*/ | ||
export declare const project: ShaderModule; | ||
export declare const project: ShaderModule<ProjectionProps, ProjectionProps>; | ||
export {}; | ||
//# sourceMappingURL=project.d.ts.map |
import { NumberArray } from '../../../types'; | ||
import { ShaderModule } from '../../../lib/shader-module/shader-module'; | ||
/** | ||
* Props for the picking module, which depending on mode renders picking colors or highlighted item. | ||
* When active, renders picking colors, assumed to be rendered to off-screen "picking" buffer. | ||
* When inactive, renders normal colors, with the exception of selected object which is rendered with highlight | ||
*/ | ||
export type PickingProps = { | ||
/** Are we picking? I.e. rendering picking colors? */ | ||
isActive?: boolean; | ||
/** Do we have a highlighted item? */ | ||
isHighlightActive?: boolean; | ||
/** Set to true when picking an attribute value instead of object index */ | ||
isAttribute?: boolean; | ||
/** Set to a picking color to visually highlight that item, or `null` to explicitly clear **/ | ||
highlightedObjectColor?: NumberArray | null; | ||
/** Color of visual highlight of "selected" item */ | ||
highlightColor?: NumberArray; | ||
/** Color range 0-1 or 0-255 */ | ||
useFloatColors?: boolean; | ||
}; | ||
export type PickingSettings = Omit<PickingUniforms, 'isHighlightActive' | 'highlightedObjectColor'> & { | ||
/** | ||
* Set to a picking color to visually highlight that item. | ||
* The picking module will persist the last highlighted object, unless | ||
* `null` is passed to explicitly clear | ||
**/ | ||
highlightedObjectColor?: NumberArray | null; | ||
/** Color of visual highlight of "selected" item */ | ||
highlightColor?: NumberArray; | ||
}; | ||
/** | ||
* Uniforms for the picking module, which renders picking colors and highlighted item. | ||
@@ -15,3 +44,3 @@ * When active, renders picking colors, assumed to be rendered to off-screen "picking" buffer. | ||
/** Set to true when picking an attribute value instead of object index */ | ||
isAttribute: boolean; | ||
isAttribute?: boolean; | ||
/** Color range 0-1 or 0-255 */ | ||
@@ -26,10 +55,2 @@ useFloatColors?: boolean; | ||
}; | ||
export type PickingSettings = Omit<PickingUniforms, 'isHighlightActive' | 'highlightedObjectColor'> & { | ||
/** | ||
* Set to a picking color to visually highlight that item. | ||
* The picking module will persist the last highlighted object, unless | ||
* `null` is passed to explicitly clear | ||
**/ | ||
highlightedObjectColor?: NumberArray | null; | ||
}; | ||
/** | ||
@@ -42,3 +63,3 @@ * Provides support for color-coding-based picking and highlighting. | ||
*/ | ||
export declare const picking: ShaderModule<PickingUniforms, PickingSettings>; | ||
export declare const picking: ShaderModule<PickingProps, PickingUniforms>; | ||
//# sourceMappingURL=picking.d.ts.map |
@@ -7,3 +7,3 @@ import { NumericArray as NumberArray, Matrix4, Vector3 } from '@math.gl/core'; | ||
*/ | ||
export type ProjectionSettings = { | ||
export type ProjectionProps = { | ||
viewMatrix?: Readonly<Matrix4 | NumberArray>; | ||
@@ -26,3 +26,3 @@ projectionMatrix?: Readonly<Matrix4 | NumberArray>; | ||
*/ | ||
export declare const projection: ShaderModule; | ||
export declare const projection: ShaderModule<ProjectionProps, ProjectionUniforms>; | ||
//# sourceMappingURL=project.d.ts.map |
import type { NumberArray } from '@math.gl/types'; | ||
import { ShaderModule } from '../../../lib/shader-module/shader-module'; | ||
/** Shader type field for lights */ | ||
declare enum LIGHT_TYPE { | ||
POINT = 0, | ||
DIRECTIONAL = 1 | ||
} | ||
/** Lighting helper types */ | ||
@@ -29,14 +24,17 @@ export type Light = AmbientLight | PointLight | DirectionalLight; | ||
}; | ||
export type LightingModuleProps = { | ||
export type LightingProps = { | ||
enabled?: boolean; | ||
lights?: Light[]; | ||
/** @deprecated */ | ||
ambientLight?: AmbientLight; | ||
/** @deprecated */ | ||
pointLights?: PointLight[]; | ||
/** @deprecated */ | ||
directionalLights?: DirectionalLight[]; | ||
}; | ||
export type LightingModuleUniforms = { | ||
enabled: boolean; | ||
export type LightingUniforms = { | ||
enabled: number; | ||
ambientLightColor: Readonly<NumberArray>; | ||
numberOfLights: number; | ||
lightType: LIGHT_TYPE; | ||
lightType: number; | ||
lightColor: Readonly<NumberArray>; | ||
@@ -48,4 +46,3 @@ lightPosition: Readonly<NumberArray>; | ||
/** UBO ready lighting module */ | ||
export declare const lighting: ShaderModule<LightingModuleUniforms, LightingModuleProps>; | ||
export {}; | ||
export declare const lighting: ShaderModule<LightingProps, LightingUniforms>; | ||
//# sourceMappingURL=lighting-uniforms.d.ts.map |
@@ -22,3 +22,3 @@ import { glsl } from "../../../lib/glsl-utils/highlight.js"; | ||
uniform lightingUniforms { | ||
bool enabled; | ||
int enabled; | ||
int pointLightCount; | ||
@@ -25,0 +25,0 @@ int directionalLightCount; |
@@ -13,3 +13,5 @@ import { lightingUniforms } from "./lighting-uniforms.glsl.js"; | ||
fs: lightingUniforms, | ||
getUniforms, | ||
getUniforms(props, prevUniforms) { | ||
return getUniforms(props); | ||
}, | ||
defines: { | ||
@@ -29,3 +31,3 @@ MAX_LIGHTS | ||
defaultUniforms: { | ||
enabled: true, | ||
enabled: 1, | ||
ambientLightColor: [0.1, 0.1, 0.1], | ||
@@ -41,2 +43,6 @@ numberOfLights: 0, | ||
function getUniforms(props) { | ||
let prevUniforms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
props = props ? { | ||
...props | ||
} : props; | ||
if (!props) { | ||
@@ -48,4 +54,7 @@ return { | ||
if (props.lights) { | ||
const lighting = extractLightTypes(props.lights); | ||
return getUniforms(lighting); | ||
props = { | ||
...props, | ||
...extractLightTypes(props.lights), | ||
lights: undefined | ||
}; | ||
} | ||
@@ -61,7 +70,8 @@ const { | ||
...lighting.defaultUniforms, | ||
enabled: false | ||
enabled: 0 | ||
}; | ||
} | ||
return { | ||
const uniforms = { | ||
...lighting.defaultUniforms, | ||
...prevUniforms, | ||
...getLightSourceUniforms({ | ||
@@ -71,5 +81,9 @@ ambientLight, | ||
directionalLights | ||
}), | ||
enabled: true | ||
}) | ||
}; | ||
if (props.enabled !== undefined) { | ||
uniforms.enabled = props.enabled ? 1 : 0; | ||
} | ||
console.error(uniforms); | ||
return uniforms; | ||
} | ||
@@ -76,0 +90,0 @@ function getLightSourceUniforms(_ref) { |
@@ -6,6 +6,7 @@ import type { NumberArray } from '@math.gl/types'; | ||
}; | ||
export type DirlightUniforms = DirlightProps; | ||
/** | ||
* Cheap lighting - single directional light, single dot product, one uniform | ||
*/ | ||
export declare const dirlight: ShaderModule<DirlightProps>; | ||
export declare const dirlight: ShaderModule<DirlightProps, DirlightUniforms>; | ||
//# sourceMappingURL=dirlight.d.ts.map |
import type { NumberArray, Texture } from '@luma.gl/core'; | ||
import type { Vector2, Vector3, Vector4 } from '@math.gl/core'; | ||
import { ShaderModule } from '../../../lib/shader-module/shader-module'; | ||
export type PBRMaterialSettings = PBRMaterialBindings & { | ||
export type PBRMaterialProps = PBRMaterialBindings & { | ||
unlit: boolean; | ||
@@ -57,4 +57,4 @@ baseColorMapEnabled: boolean; | ||
*/ | ||
export declare const pbrMaterial: ShaderModule<PBRMaterialUniforms, PBRMaterialSettings>; | ||
export declare const pbrMaterial: ShaderModule<PBRMaterialProps, PBRMaterialUniforms>; | ||
export {}; | ||
//# sourceMappingURL=pbr-material.d.ts.map |
@@ -5,4 +5,4 @@ import { lighting } from "../lights/lighting-uniforms.js"; | ||
name: 'phong-lighting', | ||
vs: PHONG_FS, | ||
fs: PHONG_VS, | ||
vs: PHONG_VS, | ||
fs: PHONG_FS, | ||
defines: { | ||
@@ -9,0 +9,0 @@ LIGHTING_FRAGMENT: 1 |
@@ -33,35 +33,38 @@ import { glsl } from "../../../lib/glsl-utils/highlight.js"; | ||
if (lighting.enabled) { | ||
vec3 view_direction = normalize(cameraPosition - position_worldspace); | ||
lightColor = material.ambient * surfaceColor * lighting.ambientColor; | ||
if (lighting.enabled == 0) { | ||
return lightColor; | ||
} | ||
if (lighting.lightType == 0) { | ||
PointLight pointLight = lighting_getPointLight(0); | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} else if (lighting.lightType == 1) { | ||
DirectionalLight directionalLight = lighting_getDirectionalLight(0); | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
vec3 view_direction = normalize(cameraPosition - position_worldspace); | ||
lightColor = material.ambient * surfaceColor * lighting.ambientColor; | ||
if (lighting.lightType == 0) { | ||
PointLight pointLight = lighting_getPointLight(0); | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} else if (lighting.lightType == 1) { | ||
DirectionalLight directionalLight = lighting_getDirectionalLight(0); | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
} | ||
/* | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.pointLightCount) { | ||
break; | ||
} | ||
/* | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.pointLightCount) { | ||
break; | ||
} | ||
PointLight pointLight = lighting.pointLight[i]; | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} | ||
PointLight pointLight = lighting.pointLight[i]; | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.directionalLightCount) { | ||
break; | ||
} | ||
DirectionalLight directionalLight = lighting.directionalLight[i]; | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.directionalLightCount) { | ||
break; | ||
} | ||
*/ | ||
DirectionalLight directionalLight = lighting.directionalLight[i]; | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
} | ||
*/ | ||
return lightColor; | ||
@@ -74,3 +77,3 @@ } | ||
if (lighting.enabled) { | ||
if (lighting.enabled == 0) { | ||
vec3 view_direction = normalize(cameraPosition - position_worldspace); | ||
@@ -77,0 +80,0 @@ |
import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
export type FXAAProps = {}; | ||
export type FXAAUniforms = {}; | ||
@@ -6,3 +7,3 @@ /** | ||
*/ | ||
export declare const fxaa: ShaderPass<FXAAUniforms>; | ||
export declare const fxaa: ShaderPass<FXAAProps, FXAAUniforms>; | ||
//# sourceMappingURL=fxaa.d.ts.map |
@@ -13,3 +13,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const noise: ShaderPass<NoiseProps>; | ||
export declare const noise: ShaderPass<NoiseProps, NoiseProps>; | ||
//# sourceMappingURL=noise.d.ts.map |
@@ -10,3 +10,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const sepia: ShaderPass<SepiaProps>; | ||
export declare const sepia: ShaderPass<SepiaProps, SepiaProps>; | ||
//# sourceMappingURL=sepia.d.ts.map |
@@ -10,3 +10,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */ | ||
export declare const vibrance: ShaderPass<VibranceProps>; | ||
export declare const vibrance: ShaderPass<VibranceProps, VibranceProps>; | ||
//# sourceMappingURL=vibrance.d.ts.map |
@@ -15,3 +15,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const vignette: ShaderPass<VignetteProps>; | ||
export declare const vignette: ShaderPass<VignetteProps, VignetteProps>; | ||
//# sourceMappingURL=vignette.d.ts.map |
@@ -29,3 +29,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const tiltShift: ShaderPass<TiltShiftProps>; | ||
export declare const tiltShift: ShaderPass<TiltShiftProps, TiltShiftProps>; | ||
//# sourceMappingURL=tiltshift.d.ts.map |
@@ -20,3 +20,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const triangleBlur: ShaderPass<TriangleBlurProps>; | ||
export declare const triangleBlur: ShaderPass<TriangleBlurProps, TriangleBlurProps>; | ||
//# sourceMappingURL=triangleblur.d.ts.map |
@@ -15,3 +15,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const zoomBlur: ShaderPass<ZoomBlurProps>; | ||
export declare const zoomBlur: ShaderPass<ZoomBlurProps, ZoomBlurProps>; | ||
//# sourceMappingURL=zoomblur.d.ts.map |
@@ -22,3 +22,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const colorHalftone: ShaderPass<ColorHalftoneProps>; | ||
export declare const colorHalftone: ShaderPass<ColorHalftoneProps, ColorHalftoneProps>; | ||
//# sourceMappingURL=colorhalftone.d.ts.map |
@@ -20,3 +20,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const dotScreen: ShaderPass<DotScreenProps>; | ||
export declare const dotScreen: ShaderPass<DotScreenProps, DotScreenProps>; | ||
//# sourceMappingURL=dotscreen.d.ts.map |
@@ -18,3 +18,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const edgeWork: ShaderPass<EdgeWorkProps>; | ||
export declare const edgeWork: ShaderPass<EdgeWorkProps, EdgeWorkProps>; | ||
//# sourceMappingURL=edgework.d.ts.map |
@@ -18,3 +18,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const hexagonalPixelate: ShaderPass<HexagonalPixelateProps>; | ||
export declare const hexagonalPixelate: ShaderPass<HexagonalPixelateProps, HexagonalPixelateProps>; | ||
//# sourceMappingURL=hexagonalpixelate.d.ts.map |
@@ -21,3 +21,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const ink: ShaderPass<InkProps>; | ||
export declare const ink: ShaderPass<InkProps, InkProps>; | ||
//# sourceMappingURL=ink.d.ts.map |
@@ -20,3 +20,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const magnify: ShaderPass<MagnifyProps>; | ||
export declare const magnify: ShaderPass<MagnifyProps, MagnifyProps>; | ||
//# sourceMappingURL=magnify.d.ts.map |
@@ -15,3 +15,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const bulgePinch: ShaderPass<BulgePinchProps>; | ||
export declare const bulgePinch: ShaderPass<BulgePinchProps, BulgePinchProps>; | ||
//# sourceMappingURL=bulgepinch.d.ts.map |
@@ -16,3 +16,3 @@ import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
*/ | ||
export declare const swirl: ShaderPass<SwirlProps>; | ||
export declare const swirl: ShaderPass<SwirlProps, SwirlProps>; | ||
//# sourceMappingURL=swirl.d.ts.map |
import { ShaderPass } from '../../../lib/shader-module/shader-pass'; | ||
export type WarpProps = {}; | ||
export declare const warp: ShaderPass<WarpProps>; | ||
export declare const warp: ShaderPass<WarpProps, WarpProps>; | ||
//# sourceMappingURL=warp.d.ts.map |
{ | ||
"name": "@luma.gl/shadertools", | ||
"version": "9.0.0-alpha.47", | ||
"version": "9.0.0-alpha.48", | ||
"description": "Shader module system for luma.gl", | ||
@@ -49,7 +49,7 @@ "type": "module", | ||
"@babel/runtime": "^7.0.0", | ||
"@luma.gl/core": "9.0.0-alpha.47", | ||
"@luma.gl/core": "9.0.0-alpha.48", | ||
"@math.gl/core": "^4.0.0", | ||
"@math.gl/types": "^4.0.0" | ||
}, | ||
"gitHead": "7c6e28518021f98c7d0739f5cbdac386144206a1" | ||
"gitHead": "e57479712693a82ec918382020dd2593035e29b0" | ||
} |
@@ -67,6 +67,3 @@ // luma.gl, MIT license | ||
// // lighting | ||
export type { | ||
LightingModuleProps, | ||
LightingModuleProps as Lighting | ||
} from './modules/lighting/lights/lighting-uniforms'; | ||
export type {LightingProps} from './modules/lighting/lights/lighting-uniforms'; | ||
export {lighting} from './modules/lighting/lights/lighting-uniforms'; | ||
@@ -135,36 +132,3 @@ export {dirlight} from './modules/lighting/no-material/dirlight'; | ||
// // glfx BLUR shader modules | ||
// export {tiltShift} from './modules/postprocessing/image-blur-filters/tiltshift'; | ||
// export {triangleBlur} from './modules/postprocessing/image-blur-filters/triangleblur'; | ||
// export {zoomBlur} from './modules/postprocessing/image-blur-filters/zoomblur'; | ||
// // glfx image adjustment shader modules | ||
// export type {BrightnessContrastProps} from './modules/postprocessing/image-adjust-filters/brightnesscontrast'; | ||
// export {brightnessContrast} from './modules/postprocessing/image-adjust-filters/brightnesscontrast'; | ||
// export {denoise} from './modules/postprocessing/image-adjust-filters/denoise'; | ||
// export {hueSaturation} from './modules/postprocessing/image-adjust-filters/huesaturation'; | ||
// export {noise} from './modules/postprocessing/image-adjust-filters/noise'; | ||
// export {sepia} from './modules/postprocessing/image-adjust-filters/sepia'; | ||
// export {vibrance} from './modules/postprocessing/image-adjust-filters/vibrance'; | ||
// export {vignette} from './modules/postprocessing/image-adjust-filters/vignette'; | ||
// // glfx FUN shader modules | ||
// export {colorHalftone} from './modules/postprocessing/image-fun-filters/colorhalftone'; | ||
// export {dotScreen} from './modules/postprocessing/image-fun-filters/dotscreen'; | ||
// export {edgeWork} from './modules/postprocessing/image-fun-filters/edgework'; | ||
// export {hexagonalPixelate} from './modules/postprocessing/image-fun-filters/hexagonalpixelate'; | ||
// export {ink} from './modules/postprocessing/image-fun-filters/ink'; | ||
// export {magnify} from './modules/postprocessing/image-fun-filters/magnify'; | ||
// // glfx WARP shader modules | ||
// export {bulgePinch} from './modules/postprocessing/image-warp-filters/bulgepinch'; | ||
// export {swirl} from './modules/postprocessing/image-warp-filters/swirl'; | ||
// // Postprocessing | ||
// export {fxaa} from './modules/postprocessing/fxaa/fxaa'; | ||
// // experimental | ||
// export {warp as _warp} from './modules/postprocessing/image-warp-filters/warp'; | ||
// // export {transform as _transform} from './modules/postprocessing/transform/transform'; | ||
// DEPRECATED - v8 legacy shader modules (non-uniform buffer) | ||
@@ -178,3 +142,2 @@ | ||
export {project as project1} from './modules-webgl1/project/project'; | ||
export {picking as picking1} from './modules-webgl1/picking/picking'; | ||
@@ -188,2 +151,1 @@ export {lights as lights1} from './modules-webgl1/lighting/lights/lights'; | ||
export {pbr} from './modules-webgl1/lighting/pbr/pbr'; | ||
@@ -28,12 +28,15 @@ // luma.gl, MIT license | ||
/** returns GLSL shader version of given shader string */ | ||
function getShaderVersion(source: string): number { | ||
function getShaderVersion(source: string): 100 | 300 { | ||
let version = 100; | ||
const words = source.match(/[^\s]+/g); | ||
if (words && words.length >= 2 && words[0] === '#version') { | ||
const v = parseInt(words[1], 10); | ||
if (Number.isFinite(v)) { | ||
version = v; | ||
const parsedVersion = parseInt(words[1], 10); | ||
if (Number.isFinite(parsedVersion)) { | ||
version = parsedVersion; | ||
} | ||
} | ||
if (version !== 100 && version !== 300) { | ||
throw new Error(`Invalid GLSL version ${version}`); | ||
} | ||
return version; | ||
} |
@@ -5,5 +5,4 @@ // luma.gl, MIT license | ||
import type {ShaderModule} from './shader-module/shader-module'; | ||
import type {PlatformInfo} from './shader-assembly/platform-info'; | ||
import {ShaderModuleInstance} from './shader-module/shader-module-instance'; | ||
import {assembleShaders} from './shader-assembly/assemble-shaders'; | ||
import {GetUniformsFunc, assembleShaders} from './shader-assembly/assemble-shaders'; | ||
import {selectShaders, AssembleShaderProps} from './shader-assembly/select-shaders'; | ||
@@ -71,15 +70,20 @@ | ||
*/ | ||
assembleShaders(platformInfo: PlatformInfo, props: AssembleShaderProps) { | ||
assembleShaders(props: AssembleShaderProps): { | ||
vs: string; | ||
fs: string; | ||
getUniforms: GetUniformsFunc; | ||
modules:ShaderModuleInstance[]; | ||
} { | ||
const modules = this._getModuleList(props.modules); // Combine with default modules | ||
const hookFunctions = this._hookFunctions; // TODO - combine with default hook functions | ||
const options = selectShaders(platformInfo, props); | ||
const assembled = assembleShaders(platformInfo, {...options, modules, hookFunctions}); | ||
return assembled; | ||
const options = selectShaders(props); | ||
const assembled = assembleShaders({platformInfo: props.platformInfo, ...options, modules, hookFunctions}); | ||
return {...assembled, modules}; | ||
} | ||
/** | ||
* Dedupe and combine with default modules | ||
* Dedupe and combine with default modules | ||
*/ | ||
_getModuleList(appModules: (ShaderModule | ShaderModuleInstance)[] = []): (ShaderModule | ShaderModuleInstance)[] { | ||
const modules = new Array(this._defaultModules.length + appModules.length); | ||
_getModuleList(appModules: (ShaderModule | ShaderModuleInstance)[] = []): ShaderModuleInstance[] { | ||
const modules = new Array<ShaderModule | ShaderModuleInstance>(this._defaultModules.length + appModules.length); | ||
const seen: Record<string, boolean> = {}; | ||
@@ -106,4 +110,4 @@ let count = 0; | ||
return modules; | ||
return ShaderModuleInstance.instantiateModules(modules); | ||
} | ||
} |
@@ -10,3 +10,2 @@ // luma.gl, MIT license | ||
import {transpileGLSLShader} from '../shader-transpiler/transpile-glsl-shader'; | ||
import {assert} from '../utils/assert'; | ||
import {ShaderModuleInstance} from '../shader-module/shader-module-instance'; | ||
@@ -16,2 +15,4 @@ import type {ShaderInjection} from './shader-injections'; | ||
import {ShaderHook, normalizeShaderHooks, getShaderHooks} from './shader-hooks'; | ||
import {assert} from '../utils/assert'; | ||
import { getShaderInfo } from '../glsl-utils/get-shader-info'; | ||
@@ -21,3 +22,3 @@ /** Define map */ | ||
const INJECT_SHADER_DECLARATIONS = `\n\n${DECLARATION_INJECT_MARKER}\n\n`; | ||
const INJECT_SHADER_DECLARATIONS = `\n\n${DECLARATION_INJECT_MARKER}\n`; | ||
@@ -30,3 +31,2 @@ /** | ||
precision highp float; | ||
`; | ||
@@ -37,2 +37,4 @@ | ||
export type AssembleShaderOptions = { | ||
/** information about the platform (which shader language & version, extensions etc.) */ | ||
platformInfo: PlatformInfo, | ||
/** Inject shader id #defines */ | ||
@@ -54,4 +56,2 @@ id?: string; | ||
inject?: Record<string, string | ShaderInjection>; | ||
/** Whether to transpile code */ | ||
transpileToGLSL100?: boolean; | ||
/** Whether to inject prologue */ | ||
@@ -63,2 +63,22 @@ prologue?: boolean; | ||
type AssembleStageOptions = { | ||
/** Inject shader id #defines */ | ||
id?: string; | ||
/** Vertex shader */ | ||
source: string; | ||
stage: 'vertex' | 'fragment'; | ||
/** Modules to be injected */ | ||
modules: any[]; | ||
/** Defines to be injected */ | ||
defines?: Record<string, ShaderDefine>; | ||
/** Hook functions */ | ||
hookFunctions?: (ShaderHook | string)[]; | ||
/** Code injections */ | ||
inject?: Record<string, string | ShaderInjection>; | ||
/** Whether to inject prologue */ | ||
prologue?: boolean; | ||
/** logger object */ | ||
log?: any; | ||
}; | ||
/** | ||
@@ -73,3 +93,2 @@ * getUniforms function returned from the shader module system | ||
export function assembleShaders( | ||
platformInfo: PlatformInfo, | ||
options: AssembleShaderOptions | ||
@@ -84,7 +103,7 @@ ): { | ||
switch (platformInfo.shaderLanguage) { | ||
switch (options.platformInfo.shaderLanguage) { | ||
case 'glsl': | ||
return { | ||
vs: assembleGLSLShader(platformInfo, {...options, source: vs, stage: 'vertex', modules}), | ||
fs: assembleGLSLShader(platformInfo, {...options, source: fs, stage: 'fragment', modules}), | ||
vs: assembleGLSLShader(options.platformInfo, {...options, source: vs, stage: 'vertex', modules}), | ||
fs: assembleGLSLShader(options.platformInfo, {...options, source: fs, stage: 'fragment', modules}), | ||
getUniforms: assembleGetUniforms(modules) | ||
@@ -95,4 +114,4 @@ }; | ||
return { | ||
vs: assembleWGSLShader(platformInfo, {...options, source: vs, stage: 'vertex', modules}), | ||
fs: assembleWGSLShader(platformInfo, {...options, source: fs, stage: 'fragment', modules}), | ||
vs: assembleWGSLShader(options.platformInfo, {...options, source: vs, stage: 'vertex', modules}), | ||
fs: assembleWGSLShader(options.platformInfo, {...options, source: fs, stage: 'fragment', modules}), | ||
getUniforms: assembleGetUniforms(modules) | ||
@@ -110,17 +129,3 @@ }; | ||
*/ | ||
function assembleWGSLShader( | ||
platformInfo: PlatformInfo, | ||
options: { | ||
id?: string; | ||
source: string; | ||
stage: 'vertex' | 'fragment'; | ||
modules: any[]; | ||
defines?: Record<string, ShaderDefine>; | ||
hookFunctions?: any[]; | ||
inject?: Record<string, any>; | ||
transpileToGLSL100?: boolean; | ||
prologue?: boolean; | ||
log?: any; | ||
} | ||
) { | ||
function assembleWGSLShader(platformInfo: PlatformInfo, options: AssembleStageOptions) { | ||
const { | ||
@@ -182,12 +187,12 @@ // id, | ||
if (name === 'decl') { | ||
declInjections[key] = [injection]; | ||
declInjections[key] = [injection as any]; | ||
} else { | ||
mainInjections[key] = [injection]; | ||
mainInjections[key] = [injection as any]; | ||
} | ||
} else { | ||
hookInjections[key] = [injection]; | ||
hookInjections[key] = [injection as any]; | ||
} | ||
} else { | ||
// Regex injection | ||
mainInjections[key] = [injection]; | ||
mainInjections[key] = [injection as any]; | ||
} | ||
@@ -232,8 +237,2 @@ } | ||
// assembledSource = transpileShader( | ||
// assembledSource, | ||
// transpileToGLSL100 ? 100 : glslVersion, | ||
// isVertex | ||
// ); | ||
return assembledSource; | ||
@@ -254,3 +253,3 @@ } | ||
source: string; | ||
language?: 'glsl' | 'wgsl', | ||
language?: 'glsl' | 'wgsl'; | ||
stage: 'vertex' | 'fragment'; | ||
@@ -261,3 +260,2 @@ modules: ShaderModuleInstance[]; | ||
inject?: Record<string, string | ShaderInjection>; | ||
transpileToGLSL100?: boolean; | ||
prologue?: boolean; | ||
@@ -267,4 +265,2 @@ log?: any; | ||
) { | ||
const isWGSL = options.source.includes('->'); | ||
const { | ||
@@ -274,3 +270,3 @@ id, | ||
stage, | ||
language = isWGSL ? 'wgsl' : 'glsl', | ||
language = 'glsl', | ||
modules, | ||
@@ -280,4 +276,3 @@ defines = {}, | ||
inject = {}, | ||
transpileToGLSL100 = false, | ||
prologue = !isWGSL, | ||
prologue = true, | ||
log | ||
@@ -288,18 +283,11 @@ } = options; | ||
const sourceVersion = language === 'glsl' ? getShaderInfo(source).version : -1; | ||
const targetVersion = platformInfo.shaderLanguageVersion; | ||
const sourceVersionDirective = sourceVersion === 100 ? '#version 100' : '#version 300 es'; | ||
const sourceLines = source.split('\n'); | ||
let glslVersion = 100; | ||
let versionLine = ''; | ||
let coreSource = source; | ||
// Extract any version directive string from source. | ||
// TODO : keep all pre-processor statements at the beginning of the shader. | ||
if (sourceLines[0].indexOf('#version ') === 0) { | ||
glslVersion = 300; // TODO - regexp that matches actual version number | ||
versionLine = sourceLines[0]; | ||
coreSource = sourceLines.slice(1).join('\n'); | ||
} else { | ||
versionLine = `#version ${glslVersion}`; | ||
} | ||
const coreSource = sourceLines.slice(1).join('\n'); | ||
const targetVersion = transpileToGLSL100 ? 100 : glslVersion; | ||
// Combine Module and Application Defines | ||
@@ -322,3 +310,5 @@ const allDefines = {}; | ||
? `\ | ||
${versionLine} | ||
${sourceVersionDirective} | ||
// ----- PROLOGUE ------------------------- | ||
${getShaderNameDefine({id, source, stage})} | ||
@@ -328,6 +318,10 @@ ${`#define SHADER_TYPE_${stage.toUpperCase()}`} | ||
${getVersionDefines(platformInfo)} | ||
${stage === 'fragment' ? FRAGMENT_SHADER_PROLOGUE : ''} | ||
// ----- APPLICATION DEFINES ------------------------- | ||
${getApplicationDefines(allDefines)} | ||
${stage === 'fragment' ? FRAGMENT_SHADER_PROLOGUE : ''} | ||
` | ||
: `${versionLine} | ||
: `${sourceVersionDirective} | ||
`; | ||
@@ -390,2 +384,4 @@ break; | ||
assembledSource += '// ----- MAIN SHADER SOURCE -------------------------'; | ||
// For injectShader | ||
@@ -403,5 +399,7 @@ assembledSource += INJECT_SHADER_DECLARATIONS; | ||
assembledSource = injectShader(assembledSource, stage, mainInjections); | ||
if (language === 'glsl' && sourceVersion !== targetVersion) { | ||
assembledSource = transpileGLSLShader(assembledSource, targetVersion, stage); | ||
} | ||
assembledSource = transpileGLSLShader(assembledSource, targetVersion, stage); | ||
return assembledSource.trim(); | ||
@@ -451,13 +449,6 @@ } | ||
/** Generates application defines from an object of key value pairs */ | ||
function getApplicationDefines(defines: Record<string, ShaderDefine> = {}): string { | ||
let count = 0; | ||
let sourceText = ''; | ||
for (const define in defines) { | ||
if (count === 0) { | ||
sourceText += '\n// APPLICATION DEFINES\n'; | ||
} | ||
count++; | ||
const value = defines[define]; | ||
@@ -468,5 +459,2 @@ if (value || Number.isFinite(value)) { | ||
} | ||
if (count === 0) { | ||
sourceText += '\n'; | ||
} | ||
return sourceText; | ||
@@ -473,0 +461,0 @@ } |
@@ -5,3 +5,3 @@ // luma.gl, MIT license | ||
import {glsl} from '../glsl-utils/highlight'; | ||
import { PlatformInfo } from './platform-info'; | ||
import {PlatformInfo} from './platform-info'; | ||
@@ -63,4 +63,6 @@ /** Adds defines to help identify GPU architecture / platform */ | ||
export function getVersionDefines(platformInfo: PlatformInfo): string { | ||
let versionDefines = glsl`\ | ||
#if (__VERSION__ > 120) | ||
let versionDefines = ''; | ||
if (platformInfo.features.has('webgl2')) { | ||
versionDefines += glsl`\ | ||
# define FEATURE_GLSL_DERIVATIVES | ||
@@ -70,9 +72,10 @@ # define FEATURE_GLSL_DRAW_BUFFERS | ||
# define FEATURE_GLSL_TEXTURE_LOD | ||
#endif // __VERSION | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo.features.has('glsl-frag-depth')) { | ||
versionDefines += glsl`\ | ||
if (!platformInfo.features.has('webgl2')) { | ||
if (platformInfo.features.has('glsl-frag-depth')) { | ||
versionDefines += glsl`\ | ||
// FRAG_DEPTH => gl_FragDepth is available | ||
// FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available | ||
#ifdef GL_EXT_frag_depth | ||
@@ -85,27 +88,25 @@ # extension GL_EXT_frag_depth : enable | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo?.features.has('glsl-derivatives')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (platformInfo?.features.has('glsl-derivatives')) { | ||
versionDefines += glsl`\ | ||
// DERIVATIVES => dxdF, dxdY and fwidth are available | ||
// FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available | ||
#if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES) | ||
# extension GL_OES_standard_derivatives : enable | ||
# define FEATURE_GLSL_DERIVATIVES | ||
# define DERIVATIVES | ||
#endif | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo?.features.has('glsl-frag-data')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (platformInfo?.features.has('glsl-frag-data')) { | ||
versionDefines += glsl`\ | ||
// DRAW_BUFFERS => gl_FragData[] is available | ||
// FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available | ||
#ifdef GL_EXT_draw_buffers | ||
# extension GL_EXT_draw_buffers : require | ||
# define FEATURE_GLSL_DRAW_BUFFERS | ||
# define DRAW_BUFFERS | ||
#endif | ||
`; | ||
} | ||
if (!platformInfo.features.has('webgl2') && platformInfo?.features.has('glsl-texture-lod')) { | ||
versionDefines += glsl`\ | ||
} | ||
if (platformInfo?.features.has('glsl-texture-lod')) { | ||
versionDefines += glsl`\ | ||
// TEXTURE_LOD => texture2DLod etc are available | ||
@@ -118,4 +119,5 @@ #ifdef GL_EXT_shader_texture_lod | ||
`; | ||
} | ||
} | ||
return versionDefines; | ||
} |
@@ -14,2 +14,4 @@ // luma.gl, MIT license | ||
shaderLanguage: 'glsl' | 'wgsl'; | ||
/** Which shader language version is preferred */ | ||
shaderLanguageVersion: 100 | 300; | ||
/** string identifying current GPU */ | ||
@@ -16,0 +18,0 @@ gpu: string; |
@@ -7,3 +7,5 @@ // luma.gl, MIT license | ||
// Instantiate shader modules and any dependencies resolve dependencies | ||
/** | ||
* Instantiate shader modules and esolve any dependencies | ||
*/ | ||
export function resolveModules(modules: (ShaderModule | ShaderModuleInstance)[]): ShaderModuleInstance[] { | ||
@@ -10,0 +12,0 @@ const instances = ShaderModuleInstance.instantiateModules(modules); |
@@ -12,2 +12,3 @@ // luma.gl, MIT license | ||
export type AssembleShaderProps = Omit<AssembleShaderOptions, 'vs' | 'fs'> & { | ||
platformInfo: PlatformInfo; | ||
/** Vertex shader source. Can be GLSL or WGSL or both */ | ||
@@ -26,3 +27,2 @@ vs?: {glsl?: string; wgsl?: string} | string | null; | ||
export function selectShaders( | ||
platformInfo: PlatformInfo, | ||
props: AssembleShaderProps | ||
@@ -35,6 +35,6 @@ ): AssembleShaderOptions { | ||
// Resolve WGSL vs GLSL | ||
const vs = getShaderSource(platformInfo, props.vs); | ||
const vs = getShaderSource(props.platformInfo, props.vs); | ||
let fs; | ||
if (props.fs) { | ||
fs = getShaderSource(platformInfo, props.fs); | ||
fs = getShaderSource(props.platformInfo, props.fs); | ||
} | ||
@@ -41,0 +41,0 @@ |
@@ -16,3 +16,3 @@ // luma.gl, MIT license | ||
/** Generates shader code for a module */ | ||
export function generateShaderForModule(module: ShaderModule, options: ShaderGenerationOptions): string { | ||
export function generateShaderForModule(module: ShaderModule<Record<string, unknown>>, options: ShaderGenerationOptions): string { | ||
switch (options.shaderLanguage) { | ||
@@ -19,0 +19,0 @@ case 'glsl': |
@@ -5,3 +5,3 @@ // luma.gl, MIT license | ||
import {UniformFormat} from '../../../types'; | ||
import {ShaderModule, UniformValue} from '../../../lib/shader-module/shader-module'; | ||
import {ShaderModule} from '../../../lib/shader-module/shader-module'; | ||
import {capitalize} from '../utils/capitalize'; | ||
@@ -18,3 +18,3 @@ | ||
function generateGLSLUniformDeclarations<UniformsT extends Record<string, UniformValue>>(module: ShaderModule<UniformsT>, options: GLSLGenerationOptions) { | ||
function generateGLSLUniformDeclarations(module: ShaderModule, options: GLSLGenerationOptions): string { | ||
const glsl: string[] = []; | ||
@@ -21,0 +21,0 @@ |
// luma.gl, MIT license | ||
// Copyright (c) vis.gl contributors | ||
import {ShaderModule} from './shader-module'; | ||
import {ShaderModuleInstance} from './shader-module-instance'; | ||
export function normalizeShaderModule(module: any): any { | ||
export function normalizeShaderModule(module: ShaderModule): ShaderModule { | ||
if (!module.normalized) { | ||
@@ -8,0 +9,0 @@ module.normalized = true; |
@@ -9,2 +9,4 @@ // luma.gl, MIT license | ||
let index = 1; | ||
/** An initialized ShaderModule, ready to use with `assembleShaders()` */ | ||
@@ -38,8 +40,9 @@ export class ShaderModuleInstance { | ||
); | ||
assert(module.name, 'shader module has no name'); | ||
if (!module.name) { | ||
console.warn('shader module has no name'); | ||
module.name = `shader-module-${index++}`; | ||
} | ||
const moduleObject = new ShaderModuleInstance(module); | ||
moduleObject.dependencies = ShaderModuleInstance.instantiateModules( | ||
module.dependencies || [] | ||
); | ||
moduleObject.dependencies = ShaderModuleInstance.instantiateModules(module.dependencies || []); | ||
@@ -92,7 +95,10 @@ return moduleObject; | ||
const moduleName = this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_'); | ||
return `\ | ||
#define MODULE_${this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_')} | ||
// ----- MODULE ${this.name} --------------- | ||
#define MODULE_${moduleName} | ||
${moduleSource}\ | ||
// END MODULE_${this.name} | ||
`; | ||
@@ -99,0 +105,0 @@ } |
@@ -14,2 +14,4 @@ // luma.gl, MIT license | ||
/** | ||
@@ -19,11 +21,13 @@ * A shader module definition object | ||
*/ | ||
export type ShaderModule<UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, SettingsT extends Record<string, unknown> = UniformsT, BindingsT extends Record<string, unknown> = {}> = { | ||
export type ShaderModule<PropsT extends Record<string, unknown> = Record<string, unknown>, UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, BindingsT extends Record<string, unknown> = {}> = { | ||
/** Used for type inference not for values */ | ||
props?: Required<PropsT>; | ||
/** Used for type inference, not currently used for values */ | ||
uniforms?: UniformsT; | ||
name: string; | ||
fs?: string; | ||
vs?: string; | ||
/** Used for type inference, not currently used for values */ | ||
uniforms?: UniformsT; | ||
/** Uniform shader types */ | ||
/** Uniform shader types @note: Both order and types MUST match uniform block declarations in shader */ | ||
uniformTypes?: Record<keyof UniformsT, UniformFormat>; | ||
@@ -34,4 +38,6 @@ /** Uniform JS prop types */ | ||
defaultUniforms?: Required<UniformsT>; // Record<keyof UniformsT, UniformValue>; | ||
/** Function that maps settings to uniforms */ | ||
getUniforms?: (settings: Partial<SettingsT>, prevUniforms?: any /* UniformsT */) => UniformsT; | ||
// getUniforms?: (settings?: Partial<SettingsT>, prevUniforms?: any /* UniformsT */) => UniformsT; | ||
getUniforms?: (settings?: any, prevUniforms?: any) => Record<string, UniformValue>; | ||
@@ -44,5 +50,8 @@ /** uniform buffers, textures, samplers, storage, ... */ | ||
inject?: Record<string, string | {injection: string; order: number;}>; | ||
dependencies?: ShaderModule[]; | ||
dependencies?: ShaderModule<any, any>[]; | ||
/** Information on deprecated properties */ | ||
deprecations?: ShaderModuleDeprecation[]; | ||
/** Internal */ | ||
normalized?: boolean; | ||
}; | ||
@@ -49,0 +58,0 @@ |
@@ -10,3 +10,3 @@ // luma.gl, MIT license | ||
*/ | ||
export type ShaderPass<UniformsT extends Record<string, UniformValue>> = ShaderModule<UniformsT> & { | ||
export type ShaderPass<PropsT extends Record<string, unknown>, UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>> = ShaderModule<PropsT, UniformsT> & { | ||
passes?: ShaderPassData[]; | ||
@@ -13,0 +13,0 @@ }; |
@@ -7,23 +7,50 @@ // luma.gl, MIT license | ||
/** | ||
* Transpiles shader source code to target GLSL version | ||
* Transpiles GLSL 3.00 shader source code to target GLSL version (3.00 or 1.00) | ||
* | ||
* @note We always run transpiler even if same version e.g. 3.00 => 3.00 | ||
* @note For texture sampling transpilation, apps need to use non-standard texture* calls in GLSL 3.00 source | ||
* RFC: https://github.com/visgl/luma.gl/blob/7.0-release/dev-docs/RFCs/v6.0/portable-glsl-300-rfc.md | ||
*/ | ||
export function transpileGLSLShader(source: string, targetGLSLVersion: number, stage: 'vertex' | 'fragment'): string { | ||
export function transpileGLSLShader( | ||
source: string, | ||
targetGLSLVersion: 100 | 300, | ||
stage: 'vertex' | 'fragment' | ||
): string { | ||
const sourceGLSLVersion = Number(source.match(/^#version[ \t]+(\d+)/m)?.[1] || 100); | ||
if (sourceGLSLVersion !== 300) { | ||
// TODO - we splurge on a longer error message to help deck.gl custom layer developers | ||
throw new Error('luma.gl v9 only supports GLSL 3.00 shader sources'); | ||
} | ||
switch (targetGLSLVersion) { | ||
case 300: | ||
switch (stage) { | ||
case 'vertex': return convertShader(source, ES300_VERTEX_REPLACEMENTS); | ||
case 'fragment': return convertFragmentShaderTo300(source); | ||
default: throw new Error(`unknown shader stage ${stage}`); | ||
case 'vertex': | ||
source = convertShader(source, ES300_VERTEX_REPLACEMENTS); | ||
return source; | ||
case 'fragment': | ||
source = convertShader(source, ES300_FRAGMENT_REPLACEMENTS); | ||
return source; | ||
default: | ||
// Unknown shader stage | ||
throw new Error(stage); | ||
} | ||
case 100: | ||
switch (stage) { | ||
case 'vertex': return convertShader(source, ES100_VERTEX_REPLACEMENTS) | ||
case 'fragment': return convertFragmentShaderTo100(source); | ||
default: throw new Error(`unknown shader stage ${stage}`); | ||
case 'vertex': | ||
source = convertShader(source, ES100_VERTEX_REPLACEMENTS); | ||
return source; | ||
case 'fragment': | ||
source = convertShader(source, ES100_FRAGMENT_REPLACEMENTS); | ||
source = convertFragmentShaderTo100(source); | ||
return source; | ||
default: | ||
// Unknown shader stage | ||
throw new Error(stage); | ||
} | ||
default: | ||
throw new Error(`unknown GLSL version ${targetGLSLVersion}`); | ||
// Unknown GLSL version | ||
throw new Error(String(targetGLSLVersion)); | ||
} | ||
@@ -84,3 +111,3 @@ } | ||
const ES300_FRAGMENT_OUTPUT_REGEX: RegExp = /\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/; | ||
const REGEX_START_OF_MAIN: RegExp = /void\s+main\s*\([^)]*\)\s*\{\n?/; // Beginning of main | ||
// const REGEX_START_OF_MAIN: RegExp = /void\s+main\s*\([^)]*\)\s*\{\n?/; // Beginning of main | ||
@@ -94,20 +121,2 @@ function convertShader(source: string, replacements: GLSLReplacement[]) { | ||
/** Transform fragment shader source code to GLSL 3.00 */ | ||
function convertFragmentShaderTo300(source: string): string { | ||
source = convertShader(source, ES300_FRAGMENT_REPLACEMENTS); | ||
const outputMatch = ES300_FRAGMENT_OUTPUT_REGEX.exec(source); | ||
if (outputMatch) { | ||
const outputName = outputMatch[1]; | ||
source = source.replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName); | ||
} else { | ||
const outputName = 'fragmentColor'; | ||
source = source | ||
.replace(REGEX_START_OF_MAIN, (match) => `out vec4 ${outputName};\n${match}`) | ||
.replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName); | ||
} | ||
return source; | ||
} | ||
/** Transform fragment shader source code to GLSL ES 100 */ | ||
@@ -117,2 +126,4 @@ function convertFragmentShaderTo100(source: string): string { | ||
// TODO - This seems like a hack to find the color output name, | ||
// what if we have several outputs? | ||
const outputMatch = ES300_FRAGMENT_OUTPUT_REGEX.exec(source); | ||
@@ -122,3 +133,5 @@ if (outputMatch) { | ||
source = source | ||
// Remove the GLSL300 output declaration | ||
.replace(ES300_FRAGMENT_OUTPUT_REGEX, '') | ||
// Replace any found output name | ||
.replace(new RegExp(`\\b${outputName}\\b`, 'g'), ES100_FRAGMENT_OUTPUT_NAME); | ||
@@ -125,0 +138,0 @@ } |
@@ -5,2 +5,9 @@ import {Matrix4} from '@math.gl/core'; | ||
type ProjectionProps = { | ||
modelMatrix?: readonly number[], | ||
viewMatrix?: readonly number[], | ||
projectionMatrix?: readonly number[], | ||
cameraPositionWorld?: readonly number[] | ||
}; | ||
const IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; | ||
@@ -15,3 +22,3 @@ | ||
function getUniforms(opts = DEFAULT_MODULE_OPTIONS, prevUniforms = {}) { | ||
function getUniforms(opts: ProjectionProps = DEFAULT_MODULE_OPTIONS, prevUniforms = {}) { | ||
// const viewProjectionInverse = viewProjection.invert(); | ||
@@ -121,5 +128,4 @@ // viewInverseMatrix: view.invert(), | ||
*/ | ||
export const project: ShaderModule = { | ||
export const project: ShaderModule<ProjectionProps, ProjectionProps> = { | ||
name: 'project', | ||
// @ts-expect-error | ||
getUniforms, | ||
@@ -126,0 +132,0 @@ vs, |
@@ -12,2 +12,34 @@ // luma.gl, MIT license | ||
/** | ||
* Props for the picking module, which depending on mode renders picking colors or highlighted item. | ||
* When active, renders picking colors, assumed to be rendered to off-screen "picking" buffer. | ||
* When inactive, renders normal colors, with the exception of selected object which is rendered with highlight | ||
*/ | ||
export type PickingProps = { | ||
/** Are we picking? I.e. rendering picking colors? */ | ||
isActive?: boolean; | ||
/** Do we have a highlighted item? */ | ||
isHighlightActive?: boolean; | ||
/** Set to true when picking an attribute value instead of object index */ | ||
isAttribute?: boolean; | ||
/** Set to a picking color to visually highlight that item, or `null` to explicitly clear **/ | ||
highlightedObjectColor?: NumberArray | null; | ||
/** Color of visual highlight of "selected" item */ | ||
highlightColor?: NumberArray; | ||
/** Color range 0-1 or 0-255 */ | ||
useFloatColors?: boolean; | ||
}; | ||
// TODO - | ||
export type PickingSettings = Omit<PickingUniforms, 'isHighlightActive' | 'highlightedObjectColor'> & { | ||
/** | ||
* Set to a picking color to visually highlight that item. | ||
* The picking module will persist the last highlighted object, unless | ||
* `null` is passed to explicitly clear | ||
**/ | ||
highlightedObjectColor?: NumberArray | null; | ||
/** Color of visual highlight of "selected" item */ | ||
highlightColor?: NumberArray; | ||
}; | ||
/** | ||
* Uniforms for the picking module, which renders picking colors and highlighted item. | ||
@@ -24,3 +56,3 @@ * When active, renders picking colors, assumed to be rendered to off-screen "picking" buffer. | ||
/** Set to true when picking an attribute value instead of object index */ | ||
isAttribute: boolean; | ||
isAttribute?: boolean; | ||
/** Color range 0-1 or 0-255 */ | ||
@@ -36,11 +68,2 @@ useFloatColors?: boolean; | ||
export type PickingSettings = Omit<PickingUniforms, 'isHighlightActive' | 'highlightedObjectColor'> & { | ||
/** | ||
* Set to a picking color to visually highlight that item. | ||
* The picking module will persist the last highlighted object, unless | ||
* `null` is passed to explicitly clear | ||
**/ | ||
highlightedObjectColor?: NumberArray | null; | ||
}; | ||
const vs = glsl`\ | ||
@@ -186,3 +209,3 @@ uniform pickingUniforms { | ||
*/ | ||
export const picking: ShaderModule<PickingUniforms, PickingSettings> = { | ||
export const picking: ShaderModule<PickingProps, PickingUniforms> = { | ||
name: 'picking', | ||
@@ -210,3 +233,3 @@ vs, | ||
function getUniforms(opts: Partial<PickingSettings> = {}, prevUniforms?: PickingUniforms): PickingUniforms { | ||
function getUniforms(opts: PickingProps = {}, prevUniforms?: PickingUniforms): PickingUniforms { | ||
const uniforms = {...picking.defaultUniforms}; | ||
@@ -213,0 +236,0 @@ |
@@ -14,3 +14,3 @@ // luma.gl, MIT license | ||
*/ | ||
export type ProjectionSettings = { | ||
export type ProjectionProps = { | ||
viewMatrix?: Readonly<Matrix4 | NumberArray>; | ||
@@ -39,3 +39,3 @@ projectionMatrix?: Readonly<Matrix4 | NumberArray>; | ||
function getUniforms(opts: ProjectionSettings = DEFAULT_MODULE_OPTIONS, prevUniforms: ProjectionUniforms = {}): ProjectionUniforms { | ||
function getUniforms(opts: ProjectionProps = DEFAULT_MODULE_OPTIONS, prevUniforms: ProjectionUniforms = {}): ProjectionUniforms { | ||
// const viewProjectionInverse = viewProjection.invert(); | ||
@@ -149,3 +149,3 @@ // viewInverseMatrix: view.invert(), | ||
*/ | ||
export const projection: ShaderModule = { | ||
export const projection: ShaderModule<ProjectionProps, ProjectionUniforms> = { | ||
name: 'projection', | ||
@@ -152,0 +152,0 @@ // Note: order and types MUST match declarations in shader |
@@ -26,3 +26,3 @@ // luma.gl, MIT license | ||
uniform lightingUniforms { | ||
bool enabled; | ||
int enabled; | ||
int pointLightCount; | ||
@@ -29,0 +29,0 @@ int directionalLightCount; |
@@ -46,15 +46,18 @@ // luma.gl, MIT license | ||
export type LightingModuleProps = { | ||
export type LightingProps = { | ||
enabled?: boolean; | ||
lights?: Light[]; | ||
/** @deprecated */ | ||
ambientLight?: AmbientLight; | ||
/** @deprecated */ | ||
pointLights?: PointLight[]; | ||
/** @deprecated */ | ||
directionalLights?: DirectionalLight[]; | ||
}; | ||
export type LightingModuleUniforms = { | ||
enabled: boolean; | ||
export type LightingUniforms = { | ||
enabled: number; | ||
ambientLightColor: Readonly<NumberArray>; | ||
numberOfLights: number; | ||
lightType: LIGHT_TYPE; // []; | ||
lightType: number; // []; | ||
lightColor: Readonly<NumberArray>; // []; | ||
@@ -67,8 +70,11 @@ lightPosition: Readonly<NumberArray>; // []; | ||
/** UBO ready lighting module */ | ||
export const lighting: ShaderModule<LightingModuleUniforms, LightingModuleProps> = { | ||
export const lighting: ShaderModule<LightingProps, LightingUniforms> = { | ||
name: 'lighting', | ||
vs: lightingUniforms, | ||
fs: lightingUniforms, | ||
getUniforms, | ||
getUniforms(props?: LightingProps, prevUniforms?: LightingUniforms): LightingUniforms { | ||
return getUniforms(props); | ||
}, | ||
defines: { | ||
@@ -91,3 +97,3 @@ MAX_LIGHTS | ||
defaultUniforms: { | ||
enabled: true, | ||
enabled: 1, | ||
ambientLightColor: [0.1, 0.1, 0.1], | ||
@@ -104,3 +110,6 @@ numberOfLights: 0, | ||
function getUniforms(props?: LightingModuleProps): LightingModuleUniforms { | ||
function getUniforms(props?: LightingProps, prevUniforms: Partial<LightingUniforms> = {}): LightingUniforms { | ||
// Copy props so we can modify | ||
props = props ? {...props} : props; | ||
// TODO legacy | ||
@@ -112,5 +121,3 @@ if (!props) { | ||
if (props.lights) { | ||
const lighting = extractLightTypes(props.lights); | ||
// Call the `props.lighting`` version | ||
return getUniforms(lighting); | ||
props = {...props, ...extractLightTypes(props.lights), lights: undefined}; | ||
} | ||
@@ -127,10 +134,17 @@ | ||
if (!hasLights) { | ||
return {...lighting.defaultUniforms, enabled: false}; | ||
return {...lighting.defaultUniforms, enabled: 0}; | ||
} | ||
return { | ||
const uniforms = { | ||
...lighting.defaultUniforms, | ||
...prevUniforms, | ||
...getLightSourceUniforms({ambientLight, pointLights, directionalLights}), | ||
enabled: true | ||
}; | ||
if (props.enabled !== undefined) { | ||
uniforms.enabled = props.enabled ? 1 : 0; | ||
} | ||
console.error(uniforms) | ||
return uniforms; | ||
} | ||
@@ -142,4 +156,4 @@ | ||
directionalLights = [] | ||
}: LightingModuleProps): Partial<LightingModuleUniforms> { | ||
const lightSourceUniforms: Partial<LightingModuleUniforms> = { | ||
}: LightingProps): Partial<LightingUniforms> { | ||
const lightSourceUniforms: Partial<LightingUniforms> = { | ||
// lightType: new Array(MAX_LIGHTS).fill(0), | ||
@@ -185,4 +199,4 @@ // lightColor: new Array(MAX_LIGHTS).fill([0, 0, 0]), | ||
function extractLightTypes(lights: Light[]): LightingModuleProps { | ||
const lightSources: LightingModuleProps = {pointLights: [], directionalLights: []}; | ||
function extractLightTypes(lights: Light[]): LightingProps { | ||
const lightSources: LightingProps = {pointLights: [], directionalLights: []}; | ||
for (const light of lights || []) { | ||
@@ -189,0 +203,0 @@ switch (light.type) { |
@@ -12,2 +12,4 @@ // luma.gl, MIT license | ||
export type DirlightUniforms = DirlightProps; | ||
const vs = glsl`\ | ||
@@ -38,3 +40,3 @@ varying vec3 dirlight_vNormal; | ||
*/ | ||
export const dirlight: ShaderModule<DirlightProps> = { | ||
export const dirlight: ShaderModule<DirlightProps, DirlightUniforms> = { | ||
name: 'dirlight', | ||
@@ -53,3 +55,3 @@ dependencies: [], | ||
function getUniforms(opts: DirlightProps = dirlight.defaultUniforms): Record<string, unknown> { | ||
function getUniforms(opts: DirlightProps = dirlight.defaultUniforms): DirlightUniforms { | ||
const uniforms: Record<string, unknown> = {}; | ||
@@ -56,0 +58,0 @@ if (opts.lightDirection) { |
@@ -14,3 +14,3 @@ // luma.gl, MIT license | ||
export type PBRMaterialSettings = PBRMaterialBindings & { | ||
export type PBRMaterialProps = PBRMaterialBindings & { | ||
unlit: boolean; | ||
@@ -98,3 +98,3 @@ | ||
*/ | ||
export const pbrMaterial: ShaderModule<PBRMaterialUniforms, PBRMaterialSettings> = { | ||
export const pbrMaterial: ShaderModule<PBRMaterialProps, PBRMaterialUniforms> = { | ||
name: 'pbr', | ||
@@ -101,0 +101,0 @@ vs, |
@@ -22,4 +22,4 @@ // luma.gl, MIT license | ||
// Note these are switched between phong and gouraud | ||
vs: PHONG_FS, | ||
fs: PHONG_VS, | ||
vs: PHONG_VS, | ||
fs: PHONG_FS, | ||
defines: { | ||
@@ -41,5 +41,5 @@ LIGHTING_FRAGMENT: 1 | ||
}, | ||
getUniforms(props: PhongMaterialProps): PhongMaterialUniforms { | ||
getUniforms(props?: PhongMaterialProps): PhongMaterialUniforms { | ||
return {...phongMaterial.defaultUniforms, ...props}; | ||
} | ||
}; |
@@ -38,35 +38,38 @@ // luma.gl, MIT license | ||
if (lighting.enabled) { | ||
vec3 view_direction = normalize(cameraPosition - position_worldspace); | ||
lightColor = material.ambient * surfaceColor * lighting.ambientColor; | ||
if (lighting.enabled == 0) { | ||
return lightColor; | ||
} | ||
if (lighting.lightType == 0) { | ||
PointLight pointLight = lighting_getPointLight(0); | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} else if (lighting.lightType == 1) { | ||
DirectionalLight directionalLight = lighting_getDirectionalLight(0); | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
vec3 view_direction = normalize(cameraPosition - position_worldspace); | ||
lightColor = material.ambient * surfaceColor * lighting.ambientColor; | ||
if (lighting.lightType == 0) { | ||
PointLight pointLight = lighting_getPointLight(0); | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} else if (lighting.lightType == 1) { | ||
DirectionalLight directionalLight = lighting_getDirectionalLight(0); | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
} | ||
/* | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.pointLightCount) { | ||
break; | ||
} | ||
/* | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.pointLightCount) { | ||
break; | ||
} | ||
PointLight pointLight = lighting.pointLight[i]; | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} | ||
PointLight pointLight = lighting.pointLight[i]; | ||
vec3 light_position_worldspace = pointLight.position; | ||
vec3 light_direction = normalize(light_position_worldspace - position_worldspace); | ||
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); | ||
} | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.directionalLightCount) { | ||
break; | ||
} | ||
DirectionalLight directionalLight = lighting.directionalLight[i]; | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
for (int i = 0; i < MAX_LIGHTS; i++) { | ||
if (i >= lighting.directionalLightCount) { | ||
break; | ||
} | ||
*/ | ||
DirectionalLight directionalLight = lighting.directionalLight[i]; | ||
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); | ||
} | ||
*/ | ||
return lightColor; | ||
@@ -79,3 +82,3 @@ } | ||
if (lighting.enabled) { | ||
if (lighting.enabled == 0) { | ||
vec3 view_direction = normalize(cameraPosition - position_worldspace); | ||
@@ -82,0 +85,0 @@ |
@@ -681,2 +681,3 @@ // luma.gl, MIT license | ||
export type FXAAProps = {}; | ||
export type FXAAUniforms = {}; | ||
@@ -687,3 +688,3 @@ | ||
*/ | ||
export const fxaa: ShaderPass<FXAAUniforms> = { | ||
export const fxaa: ShaderPass<FXAAProps, FXAAUniforms> = { | ||
name: 'fxaa', | ||
@@ -690,0 +691,0 @@ uniformPropTypes: {}, |
@@ -41,3 +41,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const noise: ShaderPass<NoiseProps> = { | ||
export const noise: ShaderPass<NoiseProps, NoiseProps> = { | ||
name: 'noise', | ||
@@ -44,0 +44,0 @@ uniformTypes: { |
@@ -39,3 +39,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const sepia: ShaderPass<SepiaProps> = { | ||
export const sepia: ShaderPass<SepiaProps, SepiaProps> = { | ||
name: 'sepia', | ||
@@ -42,0 +42,0 @@ uniformTypes: { |
@@ -34,3 +34,3 @@ // luma.gl, MIT license | ||
/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */ | ||
export const vibrance: ShaderPass<VibranceProps> = { | ||
export const vibrance: ShaderPass<VibranceProps, VibranceProps> = { | ||
name: 'vibrance', | ||
@@ -37,0 +37,0 @@ uniformPropTypes: { |
@@ -38,3 +38,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const vignette: ShaderPass<VignetteProps> = { | ||
export const vignette: ShaderPass<VignetteProps, VignetteProps> = { | ||
name: 'vignette', | ||
@@ -41,0 +41,0 @@ fs, |
@@ -82,3 +82,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const tiltShift: ShaderPass<TiltShiftProps> = { | ||
export const tiltShift: ShaderPass<TiltShiftProps, TiltShiftProps> = { | ||
name: 'tiltShift', | ||
@@ -85,0 +85,0 @@ uniformTypes: { |
@@ -61,3 +61,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const triangleBlur: ShaderPass<TriangleBlurProps> = { | ||
export const triangleBlur: ShaderPass<TriangleBlurProps, TriangleBlurProps> = { | ||
name: 'triangleBlur', | ||
@@ -64,0 +64,0 @@ uniformTypes: { |
@@ -54,3 +54,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const zoomBlur: ShaderPass<ZoomBlurProps> = { | ||
export const zoomBlur: ShaderPass<ZoomBlurProps, ZoomBlurProps> = { | ||
name: 'zoomBlur', | ||
@@ -57,0 +57,0 @@ uniformTypes: { |
@@ -66,3 +66,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const colorHalftone: ShaderPass<ColorHalftoneProps> = { | ||
export const colorHalftone: ShaderPass<ColorHalftoneProps, ColorHalftoneProps> = { | ||
name: 'colorHalftone', | ||
@@ -69,0 +69,0 @@ uniformTypes: { |
@@ -51,3 +51,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const dotScreen: ShaderPass<DotScreenProps> = { | ||
export const dotScreen: ShaderPass<DotScreenProps, DotScreenProps> = { | ||
name: 'dotScreen', | ||
@@ -54,0 +54,0 @@ uniformTypes: { |
@@ -82,3 +82,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const edgeWork: ShaderPass<EdgeWorkProps> = { | ||
export const edgeWork: ShaderPass<EdgeWorkProps, EdgeWorkProps> = { | ||
name: 'edgeWork', | ||
@@ -85,0 +85,0 @@ uniformPropTypes: { |
@@ -69,3 +69,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const hexagonalPixelate: ShaderPass<HexagonalPixelateProps> = { | ||
export const hexagonalPixelate: ShaderPass<HexagonalPixelateProps, HexagonalPixelateProps> = { | ||
name: 'hexagonalPixelate', | ||
@@ -72,0 +72,0 @@ uniformTypes: { |
@@ -57,3 +57,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const ink: ShaderPass<InkProps> = { | ||
export const ink: ShaderPass<InkProps, InkProps> = { | ||
name: 'ink', | ||
@@ -60,0 +60,0 @@ uniformTypes: { |
@@ -49,3 +49,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const magnify: ShaderPass<MagnifyProps> = { | ||
export const magnify: ShaderPass<MagnifyProps, MagnifyProps> = { | ||
name: 'magnify', | ||
@@ -52,0 +52,0 @@ uniformTypes: { |
@@ -52,3 +52,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const bulgePinch: ShaderPass<BulgePinchProps> = { | ||
export const bulgePinch: ShaderPass<BulgePinchProps, BulgePinchProps> = { | ||
name: 'bulgePinch', | ||
@@ -55,0 +55,0 @@ fs, |
@@ -55,3 +55,3 @@ // luma.gl, MIT license | ||
*/ | ||
export const swirl: ShaderPass<SwirlProps> = { | ||
export const swirl: ShaderPass<SwirlProps, SwirlProps> = { | ||
name: 'swirl', | ||
@@ -58,0 +58,0 @@ fs, |
@@ -22,5 +22,5 @@ // luma.gl, MIT license | ||
export const warp: ShaderPass<WarpProps> = { | ||
export const warp: ShaderPass<WarpProps, WarpProps> = { | ||
name: 'warp', | ||
fs | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2404608
408
45906
+ Added@luma.gl/core@9.0.0-alpha.48(transitive)
- Removed@luma.gl/core@9.0.0-alpha.47(transitive)
Updated@luma.gl/core@9.0.0-alpha.48