@babylonjs/core 6.38.0 → 6.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/Engines/ICanvas.d.ts +60 -0
  2. package/Engines/ICanvas.js.map +1 -1
  3. package/Engines/IPipelineContext.d.ts +3 -3
  4. package/Engines/IPipelineContext.js.map +1 -1
  5. package/Engines/Native/nativePipelineContext.d.ts +4 -5
  6. package/Engines/Native/nativePipelineContext.js +2 -9
  7. package/Engines/Native/nativePipelineContext.js.map +1 -1
  8. package/Engines/Native/validatedNativeDataStream.d.ts +3 -0
  9. package/Engines/Native/validatedNativeDataStream.js +3 -0
  10. package/Engines/Native/validatedNativeDataStream.js.map +1 -1
  11. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  12. package/Engines/WebGPU/webgpuConstants.d.ts +3 -1
  13. package/Engines/WebGPU/webgpuConstants.js +2 -0
  14. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  15. package/Engines/engine.d.ts +10 -45
  16. package/Engines/nativeEngine.d.ts +3 -1
  17. package/Engines/nativeEngine.js +29 -30
  18. package/Engines/nativeEngine.js.map +1 -1
  19. package/Engines/thinEngine.js +2 -2
  20. package/Engines/thinEngine.js.map +1 -1
  21. package/Engines/webgpuEngine.js +0 -1
  22. package/Engines/webgpuEngine.js.map +1 -1
  23. package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
  24. package/FlowGraph/Blocks/Data/Logic/index.js +0 -1
  25. package/FlowGraph/Blocks/Data/Logic/index.js.map +1 -1
  26. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +327 -1
  27. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +465 -74
  28. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  29. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -0
  30. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
  32. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +2 -2
  33. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  34. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +7 -3
  35. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -6
  36. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  37. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +14 -0
  38. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +4 -0
  39. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  40. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -0
  41. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  42. package/FlowGraph/flowGraphConnection.d.ts +16 -0
  43. package/FlowGraph/flowGraphConnection.js.map +1 -1
  44. package/FlowGraph/flowGraphContext.d.ts +14 -0
  45. package/FlowGraph/flowGraphContext.js.map +1 -1
  46. package/FlowGraph/flowGraphInteger.d.ts +62 -0
  47. package/FlowGraph/flowGraphInteger.js +76 -0
  48. package/FlowGraph/flowGraphInteger.js.map +1 -0
  49. package/FlowGraph/flowGraphPathConverterComponent.d.ts +2 -1
  50. package/FlowGraph/flowGraphPathConverterComponent.js +3 -3
  51. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  52. package/FlowGraph/flowGraphRichTypes.d.ts +2 -0
  53. package/FlowGraph/flowGraphRichTypes.js +5 -0
  54. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  55. package/FlowGraph/serialization.js +8 -1
  56. package/FlowGraph/serialization.js.map +1 -1
  57. package/Inputs/scene.inputManager.js +1 -1
  58. package/Inputs/scene.inputManager.js.map +1 -1
  59. package/Lights/spotLight.js +1 -1
  60. package/Lights/spotLight.js.map +1 -1
  61. package/Materials/Node/Blocks/addBlock.js +1 -1
  62. package/Materials/Node/Blocks/addBlock.js.map +1 -1
  63. package/Materials/Node/Blocks/divideBlock.js +1 -1
  64. package/Materials/Node/Blocks/divideBlock.js.map +1 -1
  65. package/Materials/Node/Blocks/multiplyBlock.js +1 -1
  66. package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
  67. package/Materials/Node/Blocks/subtractBlock.js +1 -1
  68. package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
  69. package/Materials/PBR/pbrMaterial.d.ts +1 -0
  70. package/Materials/PBR/pbrMaterial.js +1 -0
  71. package/Materials/PBR/pbrMaterial.js.map +1 -1
  72. package/Materials/effect.js +2 -1
  73. package/Materials/effect.js.map +1 -1
  74. package/Navigation/INavigationEngine.d.ts +10 -1
  75. package/Navigation/INavigationEngine.js.map +1 -1
  76. package/Navigation/Plugins/recastJSPlugin.d.ts +20 -0
  77. package/Navigation/Plugins/recastJSPlugin.js +43 -8
  78. package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
  79. package/ObjectModel/objectModelInterfaces.d.ts +5 -0
  80. package/ObjectModel/objectModelInterfaces.js.map +1 -1
  81. package/Physics/v2/ragdoll.js +4 -0
  82. package/Physics/v2/ragdoll.js.map +1 -1
  83. package/XR/features/WebXRControllerPointerSelection.js +1 -0
  84. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  85. package/node.d.ts +3 -0
  86. package/node.js +3 -0
  87. package/node.js.map +1 -1
  88. package/package.json +1 -1
  89. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +0 -60
  90. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +0 -104
  91. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"effect.js","sourceRoot":"","sources":["../../../../d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AAG,cAAc,CAAC,IAAI;QACxH,IAAI,WAAW,EAAE;YACb,iBAAiB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,aAAa,CAAC,GAAG,WAAW,CAAC;SACzF;QAED,IAAI,YAAY,EAAE;YACd,iBAAiB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,cAAc,CAAC,GAAG,YAAY,CAAC;SAC3F;IACL,CAAC;IAWD;;OAEG;IACI,MAAM,CAAC,UAAU;QACpB,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC;IAC3B,CAAC;;AAh7CD;;GAEG;AACW,sCAA+B,GAAG,IAAI,AAAP,CAAQ;AA+EtC,oBAAa,GAAG,CAAC,AAAJ,CAAK;AA4ClB,iBAAU,GAAkC,EAAE,AAApC,CAAqC;AAoyC9D;;GAEG;AACW,mBAAY,GAA8B,iBAAiB,CAAC,YAAY,AAA5D,CAA6D;AACvF;;GAEG;AACW,2BAAoB,GAA8B,iBAAiB,CAAC,oBAAoB,AAApE,CAAqE","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { FloatArray, Nullable } from \"../types\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { GetDOMTextContent, IsWindowObjectExist } from \"../Misc/domManagement\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { IDisposable } from \"../scene\";\r\nimport type { IPipelineContext } from \"../Engines/IPipelineContext\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor\";\r\nimport type { IShaderProcessor } from \"../Engines/Processors/iShaderProcessor\";\r\nimport type { ProcessingOptions, ShaderCustomProcessingFunction, ShaderProcessingContext } from \"../Engines/Processors/shaderProcessingOptions\";\r\nimport type { IMatrixLike, IVector2Like, IVector3Like, IVector4Like, IColor3Like, IColor4Like, IQuaternionLike } from \"../Maths/math.like\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport type { IEffectFallbacks } from \"./iEffectFallbacks\";\r\nimport { ShaderStore as EngineShaderStore } from \"../Engines/shaderStore\";\r\nimport { ShaderLanguage } from \"./shaderLanguage\";\r\n\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport type { ThinTexture } from \"../Materials/Textures/thinTexture\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\n\r\n/**\r\n * Options to be used when creating an effect.\r\n */\r\nexport interface IEffectCreationOptions {\r\n /**\r\n * Attributes that will be used in the shader.\r\n */\r\n attributes: string[];\r\n /**\r\n * Uniform variable names that will be set in the shader.\r\n */\r\n uniformsNames: string[];\r\n /**\r\n * Uniform buffer variable names that will be set in the shader.\r\n */\r\n uniformBuffersNames: string[];\r\n /**\r\n * Sampler texture variable names that will be set in the shader.\r\n */\r\n samplers: string[];\r\n /**\r\n * Define statements that will be set in the shader.\r\n */\r\n defines: any;\r\n /**\r\n * Possible fallbacks for this effect to improve performance when needed.\r\n */\r\n fallbacks: Nullable<IEffectFallbacks>;\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n onCompiled: Nullable<(effect: Effect) => void>;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n onError: Nullable<(effect: Effect, errors: string) => void>;\r\n /**\r\n * Parameters to be used with Babylons include syntax to iterate over an array (eg. \\{lights: 10\\})\r\n */\r\n indexParameters?: any;\r\n /**\r\n * Max number of lights that can be used in the shader.\r\n */\r\n maxSimultaneousLights?: number;\r\n /**\r\n * See https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/transformFeedbackVaryings\r\n */\r\n transformFeedbackVaryings?: Nullable<string[]>;\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU\r\n */\r\n processFinalCode?: Nullable<ShaderCustomProcessingFunction>;\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed\r\n */\r\n processCodeAfterIncludes?: Nullable<ShaderCustomProcessingFunction>;\r\n /**\r\n * Is this effect rendering to several color attachments ?\r\n */\r\n multiTarget?: boolean;\r\n /**\r\n * The language the shader is written in (default: GLSL)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n}\r\n\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nexport class Effect implements IDisposable {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n public static get ShadersRepository(): string {\r\n return EngineShaderStore.ShadersRepository;\r\n }\r\n public static set ShadersRepository(repo: string) {\r\n EngineShaderStore.ShadersRepository = repo;\r\n }\r\n /**\r\n * Enable logging of the shader code when a compilation error occurs\r\n */\r\n public static LogShaderCodeOnCompilationError = true;\r\n /**\r\n * Name of the effect.\r\n */\r\n public name: any = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n public defines: string = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n public onCompiled: Nullable<(effect: Effect) => void> = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n public onError: Nullable<(effect: Effect, errors: string) => void> = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n public onBind: Nullable<(effect: Effect) => void> = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n public uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n public onCompileObservable = new Observable<Effect>();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n public onErrorObservable = new Observable<Effect>();\r\n\r\n /** @internal */\r\n public _onBindObservable: Nullable<Observable<Effect>> = null;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously ready\r\n */\r\n public _wasPreviouslyReady = false;\r\n\r\n /**\r\n * @internal\r\n * Forces the code from bindForSubMesh to be fully run the next time it is called\r\n * It is used in frozen mode to make sure the effect is properly rebound when a new effect is created\r\n */\r\n public _forceRebindOnNextCall = false;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously using instances\r\n */\r\n public _wasPreviouslyUsingInstances: Nullable<boolean> = null;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n public get onBindObservable(): Observable<Effect> {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable<Effect>();\r\n }\r\n\r\n return this._onBindObservable;\r\n }\r\n\r\n /** @internal */\r\n public _bonesComputationForcedToCPU = false;\r\n /** @internal */\r\n public _uniformBuffersNames: { [key: string]: number } = {};\r\n /** @internal */\r\n public _samplerList: string[];\r\n /** @internal */\r\n public _multiTarget: boolean = false;\r\n\r\n private static _UniqueIdSeed = 0;\r\n /** @internal */\r\n public _engine: Engine;\r\n private _uniformBuffersNamesList: string[];\r\n private _uniformsNames: string[];\r\n private _samplers: { [key: string]: number } = {};\r\n private _isReady = false;\r\n private _compilationError = \"\";\r\n private _allFallbacksProcessed = false;\r\n private _attributesNames: string[];\r\n private _attributes: number[];\r\n private _attributeLocationByName: { [name: string]: number };\r\n private _uniforms: { [key: string]: Nullable<WebGLUniformLocation> } = {};\r\n /**\r\n * Key for the effect.\r\n * @internal\r\n */\r\n public _key: string = \"\";\r\n private _indexParameters: any;\r\n private _fallbacks: Nullable<IEffectFallbacks> = null;\r\n private _vertexSourceCodeOverride: string = \"\";\r\n private _fragmentSourceCodeOverride: string = \"\";\r\n private _transformFeedbackVaryings: Nullable<string[]> = null;\r\n private _shaderLanguage: ShaderLanguage;\r\n /**\r\n * Compiled shader to webGL program.\r\n * @internal\r\n */\r\n public _pipelineContext: Nullable<IPipelineContext> = null;\r\n /** @internal */\r\n public _vertexSourceCode: string = \"\";\r\n /** @internal */\r\n public _fragmentSourceCode: string = \"\";\r\n\r\n /** @internal */\r\n private _vertexSourceCodeBeforeMigration: string = \"\";\r\n /** @internal */\r\n private _fragmentSourceCodeBeforeMigration: string = \"\";\r\n\r\n /** @internal */\r\n private _rawVertexSourceCode: string = \"\";\r\n /** @internal */\r\n private _rawFragmentSourceCode: string = \"\";\r\n\r\n private static _BaseCache: { [key: number]: DataBuffer } = {};\r\n private _processingContext: Nullable<ShaderProcessingContext>;\r\n\r\n private _processCodeAfterIncludes: ShaderCustomProcessingFunction | undefined = undefined;\r\n private _processFinalCode: Nullable<ShaderCustomProcessingFunction> = null;\r\n\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. \\{lights: 10\\})\r\n * @param key Effect Key identifying uniquely compiled shader variants\r\n * @param shaderLanguage the language the shader is written in (default: GLSL)\r\n */\r\n constructor(\r\n baseName: any,\r\n attributesNamesOrOptions: string[] | IEffectCreationOptions,\r\n uniformsNamesOrEngine: string[] | ThinEngine,\r\n samplers: Nullable<string[]> = null,\r\n engine?: ThinEngine,\r\n defines: Nullable<string> = null,\r\n fallbacks: Nullable<IEffectFallbacks> = null,\r\n onCompiled: Nullable<(effect: Effect) => void> = null,\r\n onError: Nullable<(effect: Effect, errors: string) => void> = null,\r\n indexParameters?: any,\r\n key: string = \"\",\r\n shaderLanguage = ShaderLanguage.GLSL\r\n ) {\r\n this.name = baseName;\r\n this._key = key;\r\n\r\n if ((<IEffectCreationOptions>attributesNamesOrOptions).attributes) {\r\n const options = <IEffectCreationOptions>attributesNamesOrOptions;\r\n this._engine = <Engine>uniformsNamesOrEngine;\r\n\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;\r\n this._multiTarget = !!options.multiTarget;\r\n this._shaderLanguage = options.shaderLanguage ?? ShaderLanguage.GLSL;\r\n\r\n if (options.uniformBuffersNames) {\r\n this._uniformBuffersNamesList = options.uniformBuffersNames.slice();\r\n for (let i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n\r\n this._processFinalCode = options.processFinalCode ?? null;\r\n this._processCodeAfterIncludes = options.processCodeAfterIncludes ?? undefined;\r\n } else {\r\n this._engine = <Engine>engine;\r\n this.defines = defines == null ? \"\" : defines;\r\n this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);\r\n this._samplerList = samplers ? <string[]>samplers.slice() : [];\r\n this._attributesNames = <string[]>attributesNamesOrOptions;\r\n this._uniformBuffersNamesList = [];\r\n this._shaderLanguage = shaderLanguage;\r\n\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n\r\n this._attributeLocationByName = {};\r\n\r\n this.uniqueId = Effect._UniqueIdSeed++;\r\n\r\n this._processShaderCode();\r\n }\r\n\r\n /** @internal */\r\n public _processShaderCode(shaderProcessor: Nullable<IShaderProcessor> = null, keepExistingPipelineContext = false) {\r\n let vertexSource: any;\r\n let fragmentSource: any;\r\n\r\n const baseName = this.name;\r\n const hostDocument = IsWindowObjectExist() ? this._engine.getHostDocument() : null;\r\n\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n } else if (baseName.vertexElement) {\r\n vertexSource = hostDocument ? hostDocument.getElementById(baseName.vertexElement) : null;\r\n\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n } else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n } else if (baseName.fragmentElement) {\r\n fragmentSource = hostDocument ? hostDocument.getElementById(baseName.fragmentElement) : null;\r\n\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n } else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n\r\n this._processingContext = this._engine._getShaderProcessingContext(this._shaderLanguage);\r\n\r\n let processorOptions: ProcessingOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: shaderProcessor ?? this._engine._getShaderProcessor(this._shaderLanguage),\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: EngineShaderStore.GetShadersRepository(this._shaderLanguage),\r\n includesShadersStore: EngineShaderStore.GetIncludesShadersStore(this._shaderLanguage),\r\n version: (this._engine.version * 100).toString(),\r\n platformName: this._engine.shaderPlatformName,\r\n processingContext: this._processingContext,\r\n isNDCHalfZRange: this._engine.isNDCHalfZRange,\r\n useReverseDepthBuffer: this._engine.useReverseDepthBuffer,\r\n processCodeAfterIncludes: this._processCodeAfterIncludes,\r\n };\r\n\r\n const shaderCodes: [string | undefined, string | undefined] = [undefined, undefined];\r\n const shadersLoaded = () => {\r\n if (shaderCodes[0] && shaderCodes[1]) {\r\n processorOptions.isFragment = true;\r\n const [migratedVertexCode, fragmentCode] = shaderCodes;\r\n ShaderProcessor.Process(\r\n fragmentCode,\r\n processorOptions,\r\n (migratedFragmentCode, codeBeforeMigration) => {\r\n this._fragmentSourceCodeBeforeMigration = codeBeforeMigration;\r\n if (this._processFinalCode) {\r\n migratedFragmentCode = this._processFinalCode(\"fragment\", migratedFragmentCode);\r\n }\r\n const finalShaders = ShaderProcessor.Finalize(migratedVertexCode, migratedFragmentCode, processorOptions);\r\n processorOptions = null as any;\r\n this._useFinalCode(finalShaders.vertexCode, finalShaders.fragmentCode, baseName, keepExistingPipelineContext);\r\n },\r\n this._engine\r\n );\r\n }\r\n };\r\n this._loadShader(vertexSource, \"Vertex\", \"\", (vertexCode) => {\r\n ShaderProcessor.Initialize(processorOptions);\r\n ShaderProcessor.Process(\r\n vertexCode,\r\n processorOptions,\r\n (migratedVertexCode, codeBeforeMigration) => {\r\n this._rawVertexSourceCode = vertexCode;\r\n this._vertexSourceCodeBeforeMigration = codeBeforeMigration;\r\n if (this._processFinalCode) {\r\n migratedVertexCode = this._processFinalCode(\"vertex\", migratedVertexCode);\r\n }\r\n shaderCodes[0] = migratedVertexCode;\r\n shadersLoaded();\r\n },\r\n this._engine\r\n );\r\n });\r\n this._loadShader(fragmentSource, \"Fragment\", \"Pixel\", (fragmentCode) => {\r\n this._rawFragmentSourceCode = fragmentCode;\r\n shaderCodes[1] = fragmentCode;\r\n shadersLoaded();\r\n });\r\n }\r\n\r\n private _useFinalCode(migratedVertexCode: string, migratedFragmentCode: string, baseName: any, keepExistingPipelineContext = false) {\r\n if (baseName) {\r\n const vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n\r\n this._vertexSourceCode = (this._shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = (this._shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n } else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect(keepExistingPipelineContext);\r\n }\r\n\r\n /**\r\n * Unique key for this effect\r\n */\r\n public get key(): string {\r\n return this._key;\r\n }\r\n\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n public isReady(): boolean {\r\n try {\r\n return this._isReadyInternal();\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n private _isReadyInternal(): boolean {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n public getEngine(): Engine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n public getPipelineContext(): Nullable<IPipelineContext> {\r\n return this._pipelineContext;\r\n }\r\n\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n public getAttributesNames(): string[] {\r\n return this._attributesNames;\r\n }\r\n\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n public getAttributeLocation(index: number): number {\r\n return this._attributes[index];\r\n }\r\n\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n public getAttributeLocationByName(name: string): number {\r\n return this._attributeLocationByName[name];\r\n }\r\n\r\n /**\r\n * The number of attributes.\r\n * @returns the number of attributes.\r\n */\r\n public getAttributesCount(): number {\r\n return this._attributes.length;\r\n }\r\n\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n public getUniformIndex(uniformName: string): number {\r\n return this._uniformsNames.indexOf(uniformName);\r\n }\r\n\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n public getUniform(uniformName: string): Nullable<WebGLUniformLocation> {\r\n return this._uniforms[uniformName];\r\n }\r\n\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable names.\r\n */\r\n public getSamplers(): string[] {\r\n return this._samplerList;\r\n }\r\n\r\n /**\r\n * Returns an array of uniform variable names\r\n * @returns The array of uniform variable names.\r\n */\r\n public getUniformNames(): string[] {\r\n return this._uniformsNames;\r\n }\r\n\r\n /**\r\n * Returns an array of uniform buffer variable names\r\n * @returns The array of uniform buffer variable names.\r\n */\r\n public getUniformBuffersNames(): string[] {\r\n return this._uniformBuffersNamesList;\r\n }\r\n\r\n /**\r\n * Returns the index parameters used to create the effect\r\n * @returns The index parameters object\r\n */\r\n public getIndexParameters(): any {\r\n return this._indexParameters;\r\n }\r\n\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n public getCompilationError(): string {\r\n return this._compilationError;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that all fallbacks were used during compilation\r\n * @returns true if all fallbacks were used\r\n */\r\n public allFallbacksProcessed(): boolean {\r\n return this._allFallbacksProcessed;\r\n }\r\n\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback immediately if already ready.\r\n * @param func The callback to be used.\r\n */\r\n public executeWhenCompiled(func: (effect: Effect) => void): void {\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n\r\n this.onCompileObservable.add((effect) => {\r\n func(effect);\r\n });\r\n\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(() => {\r\n this._checkIsReady(null);\r\n }, 16);\r\n }\r\n }\r\n\r\n private _checkIsReady(previousPipelineContext: Nullable<IPipelineContext>) {\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n } catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n return;\r\n }\r\n\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n\r\n setTimeout(() => {\r\n this._checkIsReady(previousPipelineContext);\r\n }, 16);\r\n }\r\n\r\n private _loadShader(shader: any, key: string, optionalKey: string, callback: (data: any) => void): void {\r\n if (typeof HTMLElement !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n const shaderCode = GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n const shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n\r\n const shaderStore = EngineShaderStore.GetShadersStore(this._shaderLanguage);\r\n\r\n // Is in local store ?\r\n if (shaderStore[shader + key + \"Shader\"]) {\r\n callback(shaderStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n\r\n if (optionalKey && shaderStore[shader + optionalKey + \"Shader\"]) {\r\n callback(shaderStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n\r\n let shaderUrl;\r\n\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n } else {\r\n shaderUrl = EngineShaderStore.GetShadersRepository(this._shaderLanguage) + shader;\r\n }\r\n\r\n // Vertex shader\r\n this._engine._loadFile(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n }\r\n\r\n /**\r\n * Gets the vertex shader source code of this effect\r\n * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)\r\n */\r\n public get vertexSourceCode(): string {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride\r\n ? this._vertexSourceCodeOverride\r\n : this._pipelineContext?._getVertexShaderCode() ?? this._vertexSourceCode;\r\n }\r\n\r\n /**\r\n * Gets the fragment shader source code of this effect\r\n * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)\r\n */\r\n public get fragmentSourceCode(): string {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride\r\n ? this._fragmentSourceCodeOverride\r\n : this._pipelineContext?._getFragmentShaderCode() ?? this._fragmentSourceCode;\r\n }\r\n\r\n /**\r\n * Gets the vertex shader source code before migration.\r\n * This is the source code after the include directives have been replaced by their contents but before the code is migrated, i.e. before ShaderProcess._ProcessShaderConversion is executed.\r\n * This method is, among other things, responsible for parsing #if/#define directives as well as converting GLES2 syntax to GLES3 (in the case of WebGL).\r\n */\r\n public get vertexSourceCodeBeforeMigration(): string {\r\n return this._vertexSourceCodeBeforeMigration;\r\n }\r\n\r\n /**\r\n * Gets the fragment shader source code before migration.\r\n * This is the source code after the include directives have been replaced by their contents but before the code is migrated, i.e. before ShaderProcess._ProcessShaderConversion is executed.\r\n * This method is, among other things, responsible for parsing #if/#define directives as well as converting GLES2 syntax to GLES3 (in the case of WebGL).\r\n */\r\n public get fragmentSourceCodeBeforeMigration(): string {\r\n return this._fragmentSourceCodeBeforeMigration;\r\n }\r\n\r\n /**\r\n * Gets the vertex shader source code before it has been modified by any processing\r\n */\r\n public get rawVertexSourceCode(): string {\r\n return this._rawVertexSourceCode;\r\n }\r\n\r\n /**\r\n * Gets the fragment shader source code before it has been modified by any processing\r\n */\r\n public get rawFragmentSourceCode(): string {\r\n return this._rawFragmentSourceCode;\r\n }\r\n\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @internal\r\n */\r\n public _rebuildProgram(vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (pipelineContext: IPipelineContext) => void, onError: (message: string) => void) {\r\n this._isReady = false;\r\n\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = (effect, error) => {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = () => {\r\n const scenes = this.getEngine().scenes;\r\n if (scenes) {\r\n for (let i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(Constants.MATERIAL_AllDirtyFlag);\r\n }\r\n }\r\n\r\n this._pipelineContext!._handlesSpectorRebuildCallback(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n }\r\n\r\n /**\r\n * Prepares the effect\r\n * @internal\r\n */\r\n public _prepareEffect(keepExistingPipelineContext = false) {\r\n const attributesNames = this._attributesNames;\r\n const defines = this.defines;\r\n\r\n const previousPipelineContext = this._pipelineContext;\r\n\r\n this._isReady = false;\r\n\r\n try {\r\n const engine = this._engine;\r\n\r\n this._pipelineContext = (keepExistingPipelineContext ? previousPipelineContext : undefined) ?? engine.createPipelineContext(this._processingContext);\r\n this._pipelineContext._name = this._key.replace(/\\r/g, \"\").replace(/\\n/g, \"|\");\r\n\r\n const rebuildRebind = (\r\n vertexSourceCode: string,\r\n fragmentSourceCode: string,\r\n onCompiled: (pipelineContext: IPipelineContext) => void,\r\n onError: (message: string) => void\r\n ) => this._rebuildProgram(vertexSourceCode, fragmentSourceCode, onCompiled, onError);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine._preparePipelineContext(\r\n this._pipelineContext,\r\n this._vertexSourceCodeOverride,\r\n this._fragmentSourceCodeOverride,\r\n true,\r\n this._rawVertexSourceCode,\r\n this._rawFragmentSourceCode,\r\n rebuildRebind,\r\n null,\r\n this._transformFeedbackVaryings,\r\n this._key\r\n );\r\n } else {\r\n engine._preparePipelineContext(\r\n this._pipelineContext,\r\n this._vertexSourceCode,\r\n this._fragmentSourceCode,\r\n false,\r\n this._rawVertexSourceCode,\r\n this._rawFragmentSourceCode,\r\n rebuildRebind,\r\n defines,\r\n this._transformFeedbackVaryings,\r\n this._key\r\n );\r\n }\r\n\r\n engine._executeWhenRenderingStateIsCompiled(this._pipelineContext, () => {\r\n this._attributes = [];\r\n this._pipelineContext!._fillEffectInformation(\r\n this,\r\n this._uniformBuffersNames,\r\n this._uniformsNames,\r\n this._uniforms,\r\n this._samplerList,\r\n this._samplers,\r\n attributesNames,\r\n this._attributes\r\n );\r\n\r\n // Caches attribute locations.\r\n if (attributesNames) {\r\n for (let i = 0; i < attributesNames.length; i++) {\r\n const name = attributesNames[i];\r\n this._attributeLocationByName[name] = this._attributes[i];\r\n }\r\n }\r\n\r\n engine.bindSamplers(this);\r\n\r\n this._compilationError = \"\";\r\n this._isReady = true;\r\n if (this.onCompiled) {\r\n this.onCompiled(this);\r\n }\r\n this.onCompileObservable.notifyObservers(this);\r\n this.onCompileObservable.clear();\r\n\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n\r\n if (previousPipelineContext && !keepExistingPipelineContext) {\r\n this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady(previousPipelineContext);\r\n }\r\n } catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n }\r\n\r\n private _getShaderCodeAndErrorLine(code: Nullable<string>, error: Nullable<string>, isFragment: boolean): [Nullable<string>, Nullable<string>] {\r\n const regexp = isFragment ? /FRAGMENT SHADER ERROR: 0:(\\d+?):/ : /VERTEX SHADER ERROR: 0:(\\d+?):/;\r\n\r\n let errorLine = null;\r\n\r\n if (error && code) {\r\n const res = error.match(regexp);\r\n if (res && res.length === 2) {\r\n const lineNumber = parseInt(res[1]);\r\n const lines = code.split(\"\\n\", -1);\r\n if (lines.length >= lineNumber) {\r\n errorLine = `Offending line [${lineNumber}] in ${isFragment ? \"fragment\" : \"vertex\"} code: ${lines[lineNumber - 1]}`;\r\n }\r\n }\r\n }\r\n\r\n return [code, errorLine];\r\n }\r\n\r\n private _processCompilationErrors(e: any, previousPipelineContext: Nullable<IPipelineContext> = null) {\r\n this._compilationError = e.message;\r\n const attributesNames = this._attributesNames;\r\n const fallbacks = this._fallbacks;\r\n\r\n // Let's go through fallbacks then\r\n Logger.Error(\"Unable to compile effect:\");\r\n Logger.Error(\r\n \"Uniforms: \" +\r\n this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n })\r\n );\r\n Logger.Error(\r\n \"Attributes: \" +\r\n attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n })\r\n );\r\n Logger.Error(\"Defines:\\n\" + this.defines);\r\n if (Effect.LogShaderCodeOnCompilationError) {\r\n let lineErrorVertex = null,\r\n lineErrorFragment = null,\r\n code = null;\r\n if (this._pipelineContext?._getVertexShaderCode()) {\r\n [code, lineErrorVertex] = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, false);\r\n if (code) {\r\n Logger.Error(\"Vertex code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if (this._pipelineContext?._getFragmentShaderCode()) {\r\n [code, lineErrorFragment] = this._getShaderCodeAndErrorLine(this._pipelineContext?._getFragmentShaderCode(), this._compilationError, true);\r\n if (code) {\r\n Logger.Error(\"Fragment code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if (lineErrorVertex) {\r\n Logger.Error(lineErrorVertex);\r\n }\r\n if (lineErrorFragment) {\r\n Logger.Error(lineErrorFragment);\r\n }\r\n }\r\n Logger.Error(\"Error: \" + this._compilationError);\r\n\r\n const notifyErrors = () => {\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n };\r\n\r\n // In case a previous compilation was successful, we need to restore the previous pipeline context\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n notifyErrors();\r\n }\r\n\r\n // Lets try to compile fallbacks as long as we have some.\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n this._allFallbacksProcessed = false;\r\n Logger.Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n } else {\r\n // Sorry we did everything we can\r\n this._allFallbacksProcessed = true;\r\n notifyErrors();\r\n this.onErrorObservable.clear();\r\n\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n } else {\r\n this._allFallbacksProcessed = true;\r\n\r\n // In case of error, without any prior successful compilation, let s notify observers\r\n if (!previousPipelineContext) {\r\n notifyErrors();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n public get isSupported(): boolean {\r\n return this._compilationError === \"\";\r\n }\r\n\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @internal\r\n */\r\n public _bindTexture(channel: string, texture: Nullable<InternalTexture>): void {\r\n this._engine._bindTexture(this._samplers[channel], texture, channel);\r\n }\r\n\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n public setTexture(channel: string, texture: Nullable<ThinTexture>): void {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture, channel);\r\n }\r\n\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n public setDepthStencilTexture(channel: string, texture: Nullable<RenderTargetTexture>): void {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture, channel);\r\n }\r\n\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n public setTextureArray(channel: string, textures: ThinTexture[]): void {\r\n const exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n const initialPos = this._samplerList.indexOf(channel);\r\n for (let index = 1; index < textures.length; index++) {\r\n const currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n\r\n // Reset every channels\r\n let channelIndex = 0;\r\n for (const key of this._samplerList) {\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures, channel);\r\n }\r\n\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n public setTextureFromPostProcess(channel: string, postProcess: Nullable<PostProcess>): void {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess, channel);\r\n }\r\n\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n public setTextureFromPostProcessOutput(channel: string, postProcess: Nullable<PostProcess>): void {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess, channel);\r\n }\r\n\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n public bindUniformBuffer(buffer: DataBuffer, name: string): void {\r\n const bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || (Effect._BaseCache[bufferName] === buffer && this._engine._features.useUBOBindingCache)) {\r\n return;\r\n }\r\n Effect._BaseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName, name);\r\n }\r\n\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n public bindUniformBlock(blockName: string, index: number): void {\r\n this._engine.bindUniformBlock(this._pipelineContext!, blockName, index);\r\n }\r\n\r\n /**\r\n * Sets an integer value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n public setInt(uniformName: string, value: number): Effect {\r\n this._pipelineContext!.setInt(uniformName, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int2 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First int in int2.\r\n * @param y Second int in int2.\r\n * @returns this effect.\r\n */\r\n public setInt2(uniformName: string, x: number, y: number): Effect {\r\n this._pipelineContext!.setInt2(uniformName, x, y);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int3 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First int in int3.\r\n * @param y Second int in int3.\r\n * @param z Third int in int3.\r\n * @returns this effect.\r\n */\r\n public setInt3(uniformName: string, x: number, y: number, z: number): Effect {\r\n this._pipelineContext!.setInt3(uniformName, x, y, z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int4 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First int in int4.\r\n * @param y Second int in int4.\r\n * @param z Third int in int4.\r\n * @param w Fourth int in int4.\r\n * @returns this effect.\r\n */\r\n public setInt4(uniformName: string, x: number, y: number, z: number, w: number): Effect {\r\n this._pipelineContext!.setInt4(uniformName, x, y, z, w);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray2(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray3(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray4(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned integer value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n public setUInt(uniformName: string, value: number): Effect {\r\n this._pipelineContext!.setUInt(uniformName, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int2 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First unsigned int in uint2.\r\n * @param y Second unsigned int in uint2.\r\n * @returns this effect.\r\n */\r\n public setUInt2(uniformName: string, x: number, y: number): Effect {\r\n this._pipelineContext!.setUInt2(uniformName, x, y);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int3 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First unsigned int in uint3.\r\n * @param y Second unsigned int in uint3.\r\n * @param z Third unsigned int in uint3.\r\n * @returns this effect.\r\n */\r\n public setUInt3(uniformName: string, x: number, y: number, z: number): Effect {\r\n this._pipelineContext!.setUInt3(uniformName, x, y, z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int4 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First unsigned int in uint4.\r\n * @param y Second unsigned int in uint4.\r\n * @param z Third unsigned int in uint4.\r\n * @param w Fourth unsigned int in uint4.\r\n * @returns this effect.\r\n */\r\n public setUInt4(uniformName: string, x: number, y: number, z: number, w: number): Effect {\r\n this._pipelineContext!.setUInt4(uniformName, x, y, z, w);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray2(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray3(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray4(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray2(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray3(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray4(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray2(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray3(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray4(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrices(uniformName: string, matrices: Float32Array | Array<number>): Effect {\r\n this._pipelineContext!.setMatrices(uniformName, matrices as Float32Array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrix(uniformName: string, matrix: IMatrixLike): Effect {\r\n this._pipelineContext!.setMatrix(uniformName, matrix);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Specified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrix3x3(uniformName: string, matrix: Float32Array | Array<number>): Effect {\r\n // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array<number>\r\n this._pipelineContext!.setMatrix3x3(uniformName, matrix as Float32Array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Specified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrix2x2(uniformName: string, matrix: Float32Array | Array<number>): Effect {\r\n // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array<number>\r\n this._pipelineContext!.setMatrix2x2(uniformName, matrix as Float32Array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n public setFloat(uniformName: string, value: number): Effect {\r\n this._pipelineContext!.setFloat(uniformName, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n public setBool(uniformName: string, bool: boolean): Effect {\r\n this._pipelineContext!.setInt(uniformName, bool ? 1 : 0);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n public setVector2(uniformName: string, vector2: IVector2Like): Effect {\r\n this._pipelineContext!.setVector2(uniformName, vector2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n public setFloat2(uniformName: string, x: number, y: number): Effect {\r\n this._pipelineContext!.setFloat2(uniformName, x, y);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n public setVector3(uniformName: string, vector3: IVector3Like): Effect {\r\n this._pipelineContext!.setVector3(uniformName, vector3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n public setFloat3(uniformName: string, x: number, y: number, z: number): Effect {\r\n this._pipelineContext!.setFloat3(uniformName, x, y, z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n public setVector4(uniformName: string, vector4: IVector4Like): Effect {\r\n this._pipelineContext!.setVector4(uniformName, vector4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Quaternion on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param quaternion Value to be set.\r\n * @returns this effect.\r\n */\r\n public setQuaternion(uniformName: string, quaternion: IQuaternionLike): Effect {\r\n this._pipelineContext!.setQuaternion(uniformName, quaternion);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect {\r\n this._pipelineContext!.setFloat4(uniformName, x, y, z, w);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n public setColor3(uniformName: string, color3: IColor3Like): Effect {\r\n this._pipelineContext!.setColor3(uniformName, color3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n public setColor4(uniformName: string, color3: IColor3Like, alpha: number): Effect {\r\n this._pipelineContext!.setColor4(uniformName, color3, alpha);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n public setDirectColor4(uniformName: string, color4: IColor4Like): Effect {\r\n this._pipelineContext!.setDirectColor4(uniformName, color4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Release all associated resources.\r\n **/\r\n public dispose() {\r\n if (this._pipelineContext) {\r\n this._pipelineContext.dispose();\r\n }\r\n this._engine._releaseEffect(this);\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n * @param shaderLanguage the language the shader is written in (default: GLSL)\r\n */\r\n public static RegisterShader(name: string, pixelShader?: string, vertexShader?: string, shaderLanguage = ShaderLanguage.GLSL) {\r\n if (pixelShader) {\r\n EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}PixelShader`] = pixelShader;\r\n }\r\n\r\n if (vertexShader) {\r\n EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}VertexShader`] = vertexShader;\r\n }\r\n }\r\n\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n public static ShadersStore: { [key: string]: string } = EngineShaderStore.ShadersStore;\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n public static IncludesShadersStore: { [key: string]: string } = EngineShaderStore.IncludesShadersStore;\r\n\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n public static ResetCache() {\r\n Effect._BaseCache = {};\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"effect.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,MAAM,E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,GAAG,IAAI,cAAc,CAAC,GAAG,YAAY,CAAC;SAC3F;IACL,CAAC;IAWD;;OAEG;IACI,MAAM,CAAC,UAAU;QACpB,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC;IAC3B,CAAC;;AAh7CD;;GAEG;AACW,sCAA+B,GAAG,IAAI,AAAP,CAAQ;AA+EtC,oBAAa,GAAG,CAAC,AAAJ,CAAK;AA4ClB,iBAAU,GAAkC,EAAE,AAApC,CAAqC;AAoyC9D;;GAEG;AACW,mBAAY,GAA8B,iBAAiB,CAAC,YAAY,AAA5D,CAA6D;AACvF;;GAEG;AACW,2BAAoB,GAA8B,iBAAiB,CAAC,oBAAoB,AAApE,CAAqE","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { FloatArray, Nullable } from \"../types\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { GetDOMTextContent, IsWindowObjectExist } from \"../Misc/domManagement\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { IDisposable } from \"../scene\";\r\nimport type { IPipelineContext } from \"../Engines/IPipelineContext\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor\";\r\nimport type { IShaderProcessor } from \"../Engines/Processors/iShaderProcessor\";\r\nimport type { ProcessingOptions, ShaderCustomProcessingFunction, ShaderProcessingContext } from \"../Engines/Processors/shaderProcessingOptions\";\r\nimport type { IMatrixLike, IVector2Like, IVector3Like, IVector4Like, IColor3Like, IColor4Like, IQuaternionLike } from \"../Maths/math.like\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport type { IEffectFallbacks } from \"./iEffectFallbacks\";\r\nimport { ShaderStore as EngineShaderStore } from \"../Engines/shaderStore\";\r\nimport { ShaderLanguage } from \"./shaderLanguage\";\r\n\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport type { ThinTexture } from \"../Materials/Textures/thinTexture\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\n\r\n/**\r\n * Options to be used when creating an effect.\r\n */\r\nexport interface IEffectCreationOptions {\r\n /**\r\n * Attributes that will be used in the shader.\r\n */\r\n attributes: string[];\r\n /**\r\n * Uniform variable names that will be set in the shader.\r\n */\r\n uniformsNames: string[];\r\n /**\r\n * Uniform buffer variable names that will be set in the shader.\r\n */\r\n uniformBuffersNames: string[];\r\n /**\r\n * Sampler texture variable names that will be set in the shader.\r\n */\r\n samplers: string[];\r\n /**\r\n * Define statements that will be set in the shader.\r\n */\r\n defines: any;\r\n /**\r\n * Possible fallbacks for this effect to improve performance when needed.\r\n */\r\n fallbacks: Nullable<IEffectFallbacks>;\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n onCompiled: Nullable<(effect: Effect) => void>;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n onError: Nullable<(effect: Effect, errors: string) => void>;\r\n /**\r\n * Parameters to be used with Babylons include syntax to iterate over an array (eg. \\{lights: 10\\})\r\n */\r\n indexParameters?: any;\r\n /**\r\n * Max number of lights that can be used in the shader.\r\n */\r\n maxSimultaneousLights?: number;\r\n /**\r\n * See https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/transformFeedbackVaryings\r\n */\r\n transformFeedbackVaryings?: Nullable<string[]>;\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU\r\n */\r\n processFinalCode?: Nullable<ShaderCustomProcessingFunction>;\r\n /**\r\n * If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed\r\n */\r\n processCodeAfterIncludes?: Nullable<ShaderCustomProcessingFunction>;\r\n /**\r\n * Is this effect rendering to several color attachments ?\r\n */\r\n multiTarget?: boolean;\r\n /**\r\n * The language the shader is written in (default: GLSL)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n}\r\n\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nexport class Effect implements IDisposable {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n public static get ShadersRepository(): string {\r\n return EngineShaderStore.ShadersRepository;\r\n }\r\n public static set ShadersRepository(repo: string) {\r\n EngineShaderStore.ShadersRepository = repo;\r\n }\r\n /**\r\n * Enable logging of the shader code when a compilation error occurs\r\n */\r\n public static LogShaderCodeOnCompilationError = true;\r\n /**\r\n * Name of the effect.\r\n */\r\n public name: any = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n public defines: string = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n public onCompiled: Nullable<(effect: Effect) => void> = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n public onError: Nullable<(effect: Effect, errors: string) => void> = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n public onBind: Nullable<(effect: Effect) => void> = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n public uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n public onCompileObservable = new Observable<Effect>();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n public onErrorObservable = new Observable<Effect>();\r\n\r\n /** @internal */\r\n public _onBindObservable: Nullable<Observable<Effect>> = null;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously ready\r\n */\r\n public _wasPreviouslyReady = false;\r\n\r\n /**\r\n * @internal\r\n * Forces the code from bindForSubMesh to be fully run the next time it is called\r\n * It is used in frozen mode to make sure the effect is properly rebound when a new effect is created\r\n */\r\n public _forceRebindOnNextCall = false;\r\n\r\n /**\r\n * @internal\r\n * Specifies if the effect was previously using instances\r\n */\r\n public _wasPreviouslyUsingInstances: Nullable<boolean> = null;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n public get onBindObservable(): Observable<Effect> {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable<Effect>();\r\n }\r\n\r\n return this._onBindObservable;\r\n }\r\n\r\n /** @internal */\r\n public _bonesComputationForcedToCPU = false;\r\n /** @internal */\r\n public _uniformBuffersNames: { [key: string]: number } = {};\r\n /** @internal */\r\n public _samplerList: string[];\r\n /** @internal */\r\n public _multiTarget: boolean = false;\r\n\r\n private static _UniqueIdSeed = 0;\r\n /** @internal */\r\n public _engine: Engine;\r\n private _uniformBuffersNamesList: string[];\r\n private _uniformsNames: string[];\r\n private _samplers: { [key: string]: number } = {};\r\n private _isReady = false;\r\n private _compilationError = \"\";\r\n private _allFallbacksProcessed = false;\r\n private _attributesNames: string[];\r\n private _attributes: number[];\r\n private _attributeLocationByName: { [name: string]: number };\r\n private _uniforms: { [key: string]: Nullable<WebGLUniformLocation> } = {};\r\n /**\r\n * Key for the effect.\r\n * @internal\r\n */\r\n public _key: string = \"\";\r\n private _indexParameters: any;\r\n private _fallbacks: Nullable<IEffectFallbacks> = null;\r\n private _vertexSourceCodeOverride: string = \"\";\r\n private _fragmentSourceCodeOverride: string = \"\";\r\n private _transformFeedbackVaryings: Nullable<string[]> = null;\r\n private _shaderLanguage: ShaderLanguage;\r\n /**\r\n * Compiled shader to webGL program.\r\n * @internal\r\n */\r\n public _pipelineContext: Nullable<IPipelineContext> = null;\r\n /** @internal */\r\n public _vertexSourceCode: string = \"\";\r\n /** @internal */\r\n public _fragmentSourceCode: string = \"\";\r\n\r\n /** @internal */\r\n private _vertexSourceCodeBeforeMigration: string = \"\";\r\n /** @internal */\r\n private _fragmentSourceCodeBeforeMigration: string = \"\";\r\n\r\n /** @internal */\r\n private _rawVertexSourceCode: string = \"\";\r\n /** @internal */\r\n private _rawFragmentSourceCode: string = \"\";\r\n\r\n private static _BaseCache: { [key: number]: DataBuffer } = {};\r\n private _processingContext: Nullable<ShaderProcessingContext>;\r\n\r\n private _processCodeAfterIncludes: ShaderCustomProcessingFunction | undefined = undefined;\r\n private _processFinalCode: Nullable<ShaderCustomProcessingFunction> = null;\r\n\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. \\{lights: 10\\})\r\n * @param key Effect Key identifying uniquely compiled shader variants\r\n * @param shaderLanguage the language the shader is written in (default: GLSL)\r\n */\r\n constructor(\r\n baseName: any,\r\n attributesNamesOrOptions: string[] | IEffectCreationOptions,\r\n uniformsNamesOrEngine: string[] | ThinEngine,\r\n samplers: Nullable<string[]> = null,\r\n engine?: ThinEngine,\r\n defines: Nullable<string> = null,\r\n fallbacks: Nullable<IEffectFallbacks> = null,\r\n onCompiled: Nullable<(effect: Effect) => void> = null,\r\n onError: Nullable<(effect: Effect, errors: string) => void> = null,\r\n indexParameters?: any,\r\n key: string = \"\",\r\n shaderLanguage = ShaderLanguage.GLSL\r\n ) {\r\n this.name = baseName;\r\n this._key = key;\r\n\r\n if ((<IEffectCreationOptions>attributesNamesOrOptions).attributes) {\r\n const options = <IEffectCreationOptions>attributesNamesOrOptions;\r\n this._engine = <Engine>uniformsNamesOrEngine;\r\n\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;\r\n this._multiTarget = !!options.multiTarget;\r\n this._shaderLanguage = options.shaderLanguage ?? ShaderLanguage.GLSL;\r\n\r\n if (options.uniformBuffersNames) {\r\n this._uniformBuffersNamesList = options.uniformBuffersNames.slice();\r\n for (let i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n\r\n this._processFinalCode = options.processFinalCode ?? null;\r\n this._processCodeAfterIncludes = options.processCodeAfterIncludes ?? undefined;\r\n } else {\r\n this._engine = <Engine>engine;\r\n this.defines = defines == null ? \"\" : defines;\r\n this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);\r\n this._samplerList = samplers ? <string[]>samplers.slice() : [];\r\n this._attributesNames = <string[]>attributesNamesOrOptions;\r\n this._uniformBuffersNamesList = [];\r\n this._shaderLanguage = shaderLanguage;\r\n\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n\r\n this._attributeLocationByName = {};\r\n\r\n this.uniqueId = Effect._UniqueIdSeed++;\r\n\r\n this._processShaderCode();\r\n }\r\n\r\n /** @internal */\r\n public _processShaderCode(shaderProcessor: Nullable<IShaderProcessor> = null, keepExistingPipelineContext = false) {\r\n let vertexSource: any;\r\n let fragmentSource: any;\r\n\r\n const baseName = this.name;\r\n const hostDocument = IsWindowObjectExist() ? this._engine.getHostDocument() : null;\r\n\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n } else if (baseName.vertexElement) {\r\n vertexSource = hostDocument ? hostDocument.getElementById(baseName.vertexElement) : null;\r\n\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n } else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n } else if (baseName.fragmentElement) {\r\n fragmentSource = hostDocument ? hostDocument.getElementById(baseName.fragmentElement) : null;\r\n\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n } else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n\r\n this._processingContext = this._engine._getShaderProcessingContext(this._shaderLanguage);\r\n\r\n let processorOptions: ProcessingOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: shaderProcessor ?? this._engine._getShaderProcessor(this._shaderLanguage),\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: EngineShaderStore.GetShadersRepository(this._shaderLanguage),\r\n includesShadersStore: EngineShaderStore.GetIncludesShadersStore(this._shaderLanguage),\r\n version: (this._engine.version * 100).toString(),\r\n platformName: this._engine.shaderPlatformName,\r\n processingContext: this._processingContext,\r\n isNDCHalfZRange: this._engine.isNDCHalfZRange,\r\n useReverseDepthBuffer: this._engine.useReverseDepthBuffer,\r\n processCodeAfterIncludes: this._processCodeAfterIncludes,\r\n };\r\n\r\n const shaderCodes: [string | undefined, string | undefined] = [undefined, undefined];\r\n const shadersLoaded = () => {\r\n if (shaderCodes[0] && shaderCodes[1]) {\r\n processorOptions.isFragment = true;\r\n const [migratedVertexCode, fragmentCode] = shaderCodes;\r\n ShaderProcessor.Process(\r\n fragmentCode,\r\n processorOptions,\r\n (migratedFragmentCode, codeBeforeMigration) => {\r\n this._fragmentSourceCodeBeforeMigration = codeBeforeMigration;\r\n if (this._processFinalCode) {\r\n migratedFragmentCode = this._processFinalCode(\"fragment\", migratedFragmentCode);\r\n }\r\n const finalShaders = ShaderProcessor.Finalize(migratedVertexCode, migratedFragmentCode, processorOptions);\r\n processorOptions = null as any;\r\n this._useFinalCode(finalShaders.vertexCode, finalShaders.fragmentCode, baseName, keepExistingPipelineContext);\r\n },\r\n this._engine\r\n );\r\n }\r\n };\r\n this._loadShader(vertexSource, \"Vertex\", \"\", (vertexCode) => {\r\n ShaderProcessor.Initialize(processorOptions);\r\n ShaderProcessor.Process(\r\n vertexCode,\r\n processorOptions,\r\n (migratedVertexCode, codeBeforeMigration) => {\r\n this._rawVertexSourceCode = vertexCode;\r\n this._vertexSourceCodeBeforeMigration = codeBeforeMigration;\r\n if (this._processFinalCode) {\r\n migratedVertexCode = this._processFinalCode(\"vertex\", migratedVertexCode);\r\n }\r\n shaderCodes[0] = migratedVertexCode;\r\n shadersLoaded();\r\n },\r\n this._engine\r\n );\r\n });\r\n this._loadShader(fragmentSource, \"Fragment\", \"Pixel\", (fragmentCode) => {\r\n this._rawFragmentSourceCode = fragmentCode;\r\n shaderCodes[1] = fragmentCode;\r\n shadersLoaded();\r\n });\r\n }\r\n\r\n private _useFinalCode(migratedVertexCode: string, migratedFragmentCode: string, baseName: any, keepExistingPipelineContext = false) {\r\n if (baseName) {\r\n const vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n\r\n this._vertexSourceCode = (this._shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = (this._shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n } else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect(keepExistingPipelineContext);\r\n }\r\n\r\n /**\r\n * Unique key for this effect\r\n */\r\n public get key(): string {\r\n return this._key;\r\n }\r\n\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n public isReady(): boolean {\r\n try {\r\n return this._isReadyInternal();\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n private _isReadyInternal(): boolean {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n public getEngine(): Engine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n public getPipelineContext(): Nullable<IPipelineContext> {\r\n return this._pipelineContext;\r\n }\r\n\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n public getAttributesNames(): string[] {\r\n return this._attributesNames;\r\n }\r\n\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n public getAttributeLocation(index: number): number {\r\n return this._attributes[index];\r\n }\r\n\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n public getAttributeLocationByName(name: string): number {\r\n return this._attributeLocationByName[name];\r\n }\r\n\r\n /**\r\n * The number of attributes.\r\n * @returns the number of attributes.\r\n */\r\n public getAttributesCount(): number {\r\n return this._attributes.length;\r\n }\r\n\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n public getUniformIndex(uniformName: string): number {\r\n return this._uniformsNames.indexOf(uniformName);\r\n }\r\n\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n public getUniform(uniformName: string): Nullable<WebGLUniformLocation> {\r\n return this._uniforms[uniformName];\r\n }\r\n\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable names.\r\n */\r\n public getSamplers(): string[] {\r\n return this._samplerList;\r\n }\r\n\r\n /**\r\n * Returns an array of uniform variable names\r\n * @returns The array of uniform variable names.\r\n */\r\n public getUniformNames(): string[] {\r\n return this._uniformsNames;\r\n }\r\n\r\n /**\r\n * Returns an array of uniform buffer variable names\r\n * @returns The array of uniform buffer variable names.\r\n */\r\n public getUniformBuffersNames(): string[] {\r\n return this._uniformBuffersNamesList;\r\n }\r\n\r\n /**\r\n * Returns the index parameters used to create the effect\r\n * @returns The index parameters object\r\n */\r\n public getIndexParameters(): any {\r\n return this._indexParameters;\r\n }\r\n\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n public getCompilationError(): string {\r\n return this._compilationError;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that all fallbacks were used during compilation\r\n * @returns true if all fallbacks were used\r\n */\r\n public allFallbacksProcessed(): boolean {\r\n return this._allFallbacksProcessed;\r\n }\r\n\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback immediately if already ready.\r\n * @param func The callback to be used.\r\n */\r\n public executeWhenCompiled(func: (effect: Effect) => void): void {\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n\r\n this.onCompileObservable.add((effect) => {\r\n func(effect);\r\n });\r\n\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(() => {\r\n this._checkIsReady(null);\r\n }, 16);\r\n }\r\n }\r\n\r\n private _checkIsReady(previousPipelineContext: Nullable<IPipelineContext>) {\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n } catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n return;\r\n }\r\n\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n\r\n setTimeout(() => {\r\n this._checkIsReady(previousPipelineContext);\r\n }, 16);\r\n }\r\n\r\n private _loadShader(shader: any, key: string, optionalKey: string, callback: (data: any) => void): void {\r\n if (typeof HTMLElement !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n const shaderCode = GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n const shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n\r\n const shaderStore = EngineShaderStore.GetShadersStore(this._shaderLanguage);\r\n\r\n // Is in local store ?\r\n if (shaderStore[shader + key + \"Shader\"]) {\r\n callback(shaderStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n\r\n if (optionalKey && shaderStore[shader + optionalKey + \"Shader\"]) {\r\n callback(shaderStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n\r\n let shaderUrl;\r\n\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n } else {\r\n shaderUrl = EngineShaderStore.GetShadersRepository(this._shaderLanguage) + shader;\r\n }\r\n\r\n // Vertex shader\r\n this._engine._loadFile(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n }\r\n\r\n /**\r\n * Gets the vertex shader source code of this effect\r\n * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)\r\n */\r\n public get vertexSourceCode(): string {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride\r\n ? this._vertexSourceCodeOverride\r\n : this._pipelineContext?._getVertexShaderCode() ?? this._vertexSourceCode;\r\n }\r\n\r\n /**\r\n * Gets the fragment shader source code of this effect\r\n * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)\r\n */\r\n public get fragmentSourceCode(): string {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride\r\n ? this._fragmentSourceCodeOverride\r\n : this._pipelineContext?._getFragmentShaderCode() ?? this._fragmentSourceCode;\r\n }\r\n\r\n /**\r\n * Gets the vertex shader source code before migration.\r\n * This is the source code after the include directives have been replaced by their contents but before the code is migrated, i.e. before ShaderProcess._ProcessShaderConversion is executed.\r\n * This method is, among other things, responsible for parsing #if/#define directives as well as converting GLES2 syntax to GLES3 (in the case of WebGL).\r\n */\r\n public get vertexSourceCodeBeforeMigration(): string {\r\n return this._vertexSourceCodeBeforeMigration;\r\n }\r\n\r\n /**\r\n * Gets the fragment shader source code before migration.\r\n * This is the source code after the include directives have been replaced by their contents but before the code is migrated, i.e. before ShaderProcess._ProcessShaderConversion is executed.\r\n * This method is, among other things, responsible for parsing #if/#define directives as well as converting GLES2 syntax to GLES3 (in the case of WebGL).\r\n */\r\n public get fragmentSourceCodeBeforeMigration(): string {\r\n return this._fragmentSourceCodeBeforeMigration;\r\n }\r\n\r\n /**\r\n * Gets the vertex shader source code before it has been modified by any processing\r\n */\r\n public get rawVertexSourceCode(): string {\r\n return this._rawVertexSourceCode;\r\n }\r\n\r\n /**\r\n * Gets the fragment shader source code before it has been modified by any processing\r\n */\r\n public get rawFragmentSourceCode(): string {\r\n return this._rawFragmentSourceCode;\r\n }\r\n\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @internal\r\n */\r\n public _rebuildProgram(vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (pipelineContext: IPipelineContext) => void, onError: (message: string) => void) {\r\n this._isReady = false;\r\n\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = (effect, error) => {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = () => {\r\n const scenes = this.getEngine().scenes;\r\n if (scenes) {\r\n for (let i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(Constants.MATERIAL_AllDirtyFlag);\r\n }\r\n }\r\n\r\n this._pipelineContext!._handlesSpectorRebuildCallback?.(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n }\r\n\r\n /**\r\n * Prepares the effect\r\n * @internal\r\n */\r\n public _prepareEffect(keepExistingPipelineContext = false) {\r\n const attributesNames = this._attributesNames;\r\n const defines = this.defines;\r\n\r\n const previousPipelineContext = this._pipelineContext;\r\n\r\n this._isReady = false;\r\n\r\n try {\r\n const engine = this._engine;\r\n\r\n this._pipelineContext = (keepExistingPipelineContext ? previousPipelineContext : undefined) ?? engine.createPipelineContext(this._processingContext);\r\n this._pipelineContext._name = this._key.replace(/\\r/g, \"\").replace(/\\n/g, \"|\");\r\n\r\n const rebuildRebind = (\r\n vertexSourceCode: string,\r\n fragmentSourceCode: string,\r\n onCompiled: (pipelineContext: IPipelineContext) => void,\r\n onError: (message: string) => void\r\n ) => this._rebuildProgram(vertexSourceCode, fragmentSourceCode, onCompiled, onError);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine._preparePipelineContext(\r\n this._pipelineContext,\r\n this._vertexSourceCodeOverride,\r\n this._fragmentSourceCodeOverride,\r\n true,\r\n this._rawVertexSourceCode,\r\n this._rawFragmentSourceCode,\r\n rebuildRebind,\r\n null,\r\n this._transformFeedbackVaryings,\r\n this._key\r\n );\r\n } else {\r\n engine._preparePipelineContext(\r\n this._pipelineContext,\r\n this._vertexSourceCode,\r\n this._fragmentSourceCode,\r\n false,\r\n this._rawVertexSourceCode,\r\n this._rawFragmentSourceCode,\r\n rebuildRebind,\r\n defines,\r\n this._transformFeedbackVaryings,\r\n this._key\r\n );\r\n }\r\n\r\n engine._executeWhenRenderingStateIsCompiled(this._pipelineContext, () => {\r\n this._attributes = [];\r\n this._pipelineContext!._fillEffectInformation(\r\n this,\r\n this._uniformBuffersNames,\r\n this._uniformsNames,\r\n this._uniforms,\r\n this._samplerList,\r\n this._samplers,\r\n attributesNames,\r\n this._attributes\r\n );\r\n\r\n // Caches attribute locations.\r\n if (attributesNames) {\r\n for (let i = 0; i < attributesNames.length; i++) {\r\n const name = attributesNames[i];\r\n this._attributeLocationByName[name] = this._attributes[i];\r\n }\r\n }\r\n\r\n engine.bindSamplers(this);\r\n\r\n this._compilationError = \"\";\r\n this._isReady = true;\r\n if (this.onCompiled) {\r\n this.onCompiled(this);\r\n }\r\n this.onCompileObservable.notifyObservers(this);\r\n this.onCompileObservable.clear();\r\n\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n\r\n if (previousPipelineContext && !keepExistingPipelineContext) {\r\n this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady(previousPipelineContext);\r\n }\r\n } catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n }\r\n\r\n private _getShaderCodeAndErrorLine(code: Nullable<string>, error: Nullable<string>, isFragment: boolean): [Nullable<string>, Nullable<string>] {\r\n const regexp = isFragment ? /FRAGMENT SHADER ERROR: 0:(\\d+?):/ : /VERTEX SHADER ERROR: 0:(\\d+?):/;\r\n\r\n let errorLine = null;\r\n\r\n if (error && code) {\r\n const res = error.match(regexp);\r\n if (res && res.length === 2) {\r\n const lineNumber = parseInt(res[1]);\r\n const lines = code.split(\"\\n\", -1);\r\n if (lines.length >= lineNumber) {\r\n errorLine = `Offending line [${lineNumber}] in ${isFragment ? \"fragment\" : \"vertex\"} code: ${lines[lineNumber - 1]}`;\r\n }\r\n }\r\n }\r\n\r\n return [code, errorLine];\r\n }\r\n\r\n private _processCompilationErrors(e: any, previousPipelineContext: Nullable<IPipelineContext> = null) {\r\n this._compilationError = e.message;\r\n const attributesNames = this._attributesNames;\r\n const fallbacks = this._fallbacks;\r\n\r\n // Let's go through fallbacks then\r\n Logger.Error(\"Unable to compile effect:\");\r\n Logger.Error(\r\n \"Uniforms: \" +\r\n this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n })\r\n );\r\n Logger.Error(\r\n \"Attributes: \" +\r\n attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n })\r\n );\r\n Logger.Error(\"Defines:\\n\" + this.defines);\r\n if (Effect.LogShaderCodeOnCompilationError) {\r\n let lineErrorVertex = null,\r\n lineErrorFragment = null,\r\n code = null;\r\n if (this._pipelineContext?._getVertexShaderCode()) {\r\n [code, lineErrorVertex] = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, false);\r\n if (code) {\r\n Logger.Error(\"Vertex code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if (this._pipelineContext?._getFragmentShaderCode()) {\r\n [code, lineErrorFragment] = this._getShaderCodeAndErrorLine(this._pipelineContext?._getFragmentShaderCode(), this._compilationError, true);\r\n if (code) {\r\n Logger.Error(\"Fragment code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if (lineErrorVertex) {\r\n Logger.Error(lineErrorVertex);\r\n }\r\n if (lineErrorFragment) {\r\n Logger.Error(lineErrorFragment);\r\n }\r\n }\r\n Logger.Error(\"Error: \" + this._compilationError);\r\n\r\n const notifyErrors = () => {\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n };\r\n\r\n // In case a previous compilation was successful, we need to restore the previous pipeline context\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n notifyErrors();\r\n }\r\n\r\n // Lets try to compile fallbacks as long as we have some.\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n this._allFallbacksProcessed = false;\r\n Logger.Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n } else {\r\n // Sorry we did everything we can\r\n this._allFallbacksProcessed = true;\r\n notifyErrors();\r\n this.onErrorObservable.clear();\r\n\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n } else {\r\n this._allFallbacksProcessed = true;\r\n\r\n // In case of error, without any prior successful compilation, let s notify observers\r\n if (!previousPipelineContext) {\r\n notifyErrors();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n public get isSupported(): boolean {\r\n return this._compilationError === \"\";\r\n }\r\n\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @internal\r\n */\r\n public _bindTexture(channel: string, texture: Nullable<InternalTexture>): void {\r\n this._engine._bindTexture(this._samplers[channel], texture, channel);\r\n }\r\n\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n public setTexture(channel: string, texture: Nullable<ThinTexture>): void {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture, channel);\r\n }\r\n\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n public setDepthStencilTexture(channel: string, texture: Nullable<RenderTargetTexture>): void {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture, channel);\r\n }\r\n\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n public setTextureArray(channel: string, textures: ThinTexture[]): void {\r\n const exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n const initialPos = this._samplerList.indexOf(channel);\r\n for (let index = 1; index < textures.length; index++) {\r\n const currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n\r\n // Reset every channels\r\n let channelIndex = 0;\r\n for (const key of this._samplerList) {\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures, channel);\r\n }\r\n\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n public setTextureFromPostProcess(channel: string, postProcess: Nullable<PostProcess>): void {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess, channel);\r\n }\r\n\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n public setTextureFromPostProcessOutput(channel: string, postProcess: Nullable<PostProcess>): void {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess, channel);\r\n }\r\n\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n public bindUniformBuffer(buffer: DataBuffer, name: string): void {\r\n const bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || (Effect._BaseCache[bufferName] === buffer && this._engine._features.useUBOBindingCache)) {\r\n return;\r\n }\r\n Effect._BaseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName, name);\r\n }\r\n\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n public bindUniformBlock(blockName: string, index: number): void {\r\n this._engine.bindUniformBlock(this._pipelineContext!, blockName, index);\r\n }\r\n\r\n /**\r\n * Sets an integer value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n public setInt(uniformName: string, value: number): Effect {\r\n this._pipelineContext!.setInt(uniformName, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int2 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First int in int2.\r\n * @param y Second int in int2.\r\n * @returns this effect.\r\n */\r\n public setInt2(uniformName: string, x: number, y: number): Effect {\r\n this._pipelineContext!.setInt2(uniformName, x, y);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int3 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First int in int3.\r\n * @param y Second int in int3.\r\n * @param z Third int in int3.\r\n * @returns this effect.\r\n */\r\n public setInt3(uniformName: string, x: number, y: number, z: number): Effect {\r\n this._pipelineContext!.setInt3(uniformName, x, y, z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int4 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First int in int4.\r\n * @param y Second int in int4.\r\n * @param z Third int in int4.\r\n * @param w Fourth int in int4.\r\n * @returns this effect.\r\n */\r\n public setInt4(uniformName: string, x: number, y: number, z: number, w: number): Effect {\r\n this._pipelineContext!.setInt4(uniformName, x, y, z, w);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray2(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray3(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setIntArray4(uniformName: string, array: Int32Array): Effect {\r\n this._pipelineContext!.setIntArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned integer value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n public setUInt(uniformName: string, value: number): Effect {\r\n this._pipelineContext!.setUInt(uniformName, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int2 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First unsigned int in uint2.\r\n * @param y Second unsigned int in uint2.\r\n * @returns this effect.\r\n */\r\n public setUInt2(uniformName: string, x: number, y: number): Effect {\r\n this._pipelineContext!.setUInt2(uniformName, x, y);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int3 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First unsigned int in uint3.\r\n * @param y Second unsigned int in uint3.\r\n * @param z Third unsigned int in uint3.\r\n * @returns this effect.\r\n */\r\n public setUInt3(uniformName: string, x: number, y: number, z: number): Effect {\r\n this._pipelineContext!.setUInt3(uniformName, x, y, z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int4 value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First unsigned int in uint4.\r\n * @param y Second unsigned int in uint4.\r\n * @param z Third unsigned int in uint4.\r\n * @param w Fourth unsigned int in uint4.\r\n * @returns this effect.\r\n */\r\n public setUInt4(uniformName: string, x: number, y: number, z: number, w: number): Effect {\r\n this._pipelineContext!.setUInt4(uniformName, x, y, z, w);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray2(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray3(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an unsigned int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setUIntArray4(uniformName: string, array: Uint32Array): Effect {\r\n this._pipelineContext!.setUIntArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray2(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray3(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setFloatArray4(uniformName: string, array: FloatArray): Effect {\r\n this._pipelineContext!.setArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray2(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray2(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray3(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray3(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n public setArray4(uniformName: string, array: number[]): Effect {\r\n this._pipelineContext!.setArray4(uniformName, array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrices(uniformName: string, matrices: Float32Array | Array<number>): Effect {\r\n this._pipelineContext!.setMatrices(uniformName, matrices as Float32Array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrix(uniformName: string, matrix: IMatrixLike): Effect {\r\n this._pipelineContext!.setMatrix(uniformName, matrix);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Specified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrix3x3(uniformName: string, matrix: Float32Array | Array<number>): Effect {\r\n // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array<number>\r\n this._pipelineContext!.setMatrix3x3(uniformName, matrix as Float32Array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Specified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n public setMatrix2x2(uniformName: string, matrix: Float32Array | Array<number>): Effect {\r\n // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array<number>\r\n this._pipelineContext!.setMatrix2x2(uniformName, matrix as Float32Array);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n public setFloat(uniformName: string, value: number): Effect {\r\n this._pipelineContext!.setFloat(uniformName, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n public setBool(uniformName: string, bool: boolean): Effect {\r\n this._pipelineContext!.setInt(uniformName, bool ? 1 : 0);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n public setVector2(uniformName: string, vector2: IVector2Like): Effect {\r\n this._pipelineContext!.setVector2(uniformName, vector2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n public setFloat2(uniformName: string, x: number, y: number): Effect {\r\n this._pipelineContext!.setFloat2(uniformName, x, y);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n public setVector3(uniformName: string, vector3: IVector3Like): Effect {\r\n this._pipelineContext!.setVector3(uniformName, vector3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n public setFloat3(uniformName: string, x: number, y: number, z: number): Effect {\r\n this._pipelineContext!.setFloat3(uniformName, x, y, z);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n public setVector4(uniformName: string, vector4: IVector4Like): Effect {\r\n this._pipelineContext!.setVector4(uniformName, vector4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Quaternion on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param quaternion Value to be set.\r\n * @returns this effect.\r\n */\r\n public setQuaternion(uniformName: string, quaternion: IQuaternionLike): Effect {\r\n this._pipelineContext!.setQuaternion(uniformName, quaternion);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect {\r\n this._pipelineContext!.setFloat4(uniformName, x, y, z, w);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n public setColor3(uniformName: string, color3: IColor3Like): Effect {\r\n this._pipelineContext!.setColor3(uniformName, color3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n public setColor4(uniformName: string, color3: IColor3Like, alpha: number): Effect {\r\n this._pipelineContext!.setColor4(uniformName, color3, alpha);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n public setDirectColor4(uniformName: string, color4: IColor4Like): Effect {\r\n this._pipelineContext!.setDirectColor4(uniformName, color4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Release all associated resources.\r\n **/\r\n public dispose() {\r\n if (this._pipelineContext) {\r\n this._pipelineContext.dispose();\r\n }\r\n this._engine._releaseEffect(this);\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n * @param shaderLanguage the language the shader is written in (default: GLSL)\r\n */\r\n public static RegisterShader(name: string, pixelShader?: string, vertexShader?: string, shaderLanguage = ShaderLanguage.GLSL) {\r\n if (pixelShader) {\r\n EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}PixelShader`] = pixelShader;\r\n }\r\n\r\n if (vertexShader) {\r\n EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}VertexShader`] = vertexShader;\r\n }\r\n }\r\n\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n public static ShadersStore: { [key: string]: string } = EngineShaderStore.ShadersStore;\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n public static IncludesShadersStore: { [key: string]: string } = EngineShaderStore.IncludesShadersStore;\r\n\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n public static ResetCache() {\r\n Effect._BaseCache = {};\r\n }\r\n}\r\n"]}
@@ -63,12 +63,21 @@ export interface INavigationEnginePlugin {
63
63
  */
64
64
  moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;
65
65
  /**
66
- * Compute a navigation path from start to end. Returns an empty array if no path can be computed
66
+ * Compute a navigation path from start to end. Returns an empty array if no path can be computed.
67
+ * Path is straight.
67
68
  * @param start world position
68
69
  * @param end world position
69
70
  * @returns array containing world position composing the path
70
71
  */
71
72
  computePath(start: Vector3, end: Vector3): Vector3[];
73
+ /**
74
+ * Compute a navigation path from start to end. Returns an empty array if no path can be computed.
75
+ * Path follows navigation mesh geometry.
76
+ * @param start world position
77
+ * @param end world position
78
+ * @returns array containing world position composing the path
79
+ */
80
+ computePathSmooth(start: Vector3, end: Vector3): Vector3[];
72
81
  /**
73
82
  * If this plugin is supported
74
83
  * @returns true if plugin is supported
@@ -1 +1 @@
1
- {"version":3,"file":"INavigationEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Navigation/INavigationEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Vector3 } from \"../Maths/math\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Scene } from \"../scene\";\r\n\r\n/**\r\n * Navigation plugin interface to add navigation constrained by a navigation mesh\r\n */\r\nexport interface INavigationEnginePlugin {\r\n /**\r\n * plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void;\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n isSupported(): boolean;\r\n\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void;\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number): void;\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number;\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): IObstacle;\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): IObstacle;\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Obstacle interface\r\n */\r\nexport interface IObstacle {}\r\n\r\n/**\r\n * Crowd Interface. A Crowd is a collection of moving agents constrained by a navigation mesh\r\n */\r\nexport interface ICrowd {\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number;\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number;\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void;\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[];\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void;\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[];\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Configures an agent\r\n */\r\nexport interface IAgentParameters {\r\n /**\r\n * Agent radius. [Limit: >= 0]\r\n */\r\n radius: number;\r\n\r\n /**\r\n * Agent height. [Limit: > 0]\r\n */\r\n height: number;\r\n\r\n /**\r\n * Maximum allowed acceleration. [Limit: >= 0]\r\n */\r\n maxAcceleration: number;\r\n\r\n /**\r\n * Maximum allowed speed. [Limit: >= 0]\r\n */\r\n maxSpeed: number;\r\n\r\n /**\r\n * Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0]\r\n */\r\n collisionQueryRange: number;\r\n\r\n /**\r\n * The path visibility optimization range. [Limit: > 0]\r\n */\r\n pathOptimizationRange: number;\r\n\r\n /**\r\n * How aggressive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0]\r\n */\r\n separationWeight: number;\r\n\r\n /**\r\n * Observers will be notified when agent gets inside the virtual circle with this Radius around destination point.\r\n * Default is agent radius\r\n */\r\n reachRadius?: number;\r\n}\r\n\r\n/**\r\n * Configures the navigation mesh creation\r\n */\r\nexport interface INavMeshParameters {\r\n /**\r\n * The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n cs: number;\r\n\r\n /**\r\n * The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n ch: number;\r\n\r\n /**\r\n * The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]\r\n */\r\n walkableSlopeAngle: number;\r\n\r\n /**\r\n * Minimum floor to 'ceiling' height that will still allow the floor area to\r\n * be considered walkable. [Limit: >= 3] [Units: vx]\r\n */\r\n walkableHeight: number;\r\n\r\n /**\r\n * Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]\r\n */\r\n walkableClimb: number;\r\n\r\n /**\r\n * The distance to erode/shrink the walkable area of the heightfield away from\r\n * obstructions. [Limit: >=0] [Units: vx]\r\n */\r\n walkableRadius: number;\r\n\r\n /**\r\n * The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]\r\n */\r\n maxEdgeLen: number;\r\n\r\n /**\r\n * The maximum distance a simplified contour's border edges should deviate\r\n * the original raw contour. [Limit: >=0] [Units: vx]\r\n */\r\n maxSimplificationError: number;\r\n\r\n /**\r\n * The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]\r\n */\r\n minRegionArea: number;\r\n\r\n /**\r\n * Any regions with a span count smaller than this value will, if possible,\r\n * be merged with larger regions. [Limit: >=0] [Units: vx]\r\n */\r\n mergeRegionArea: number;\r\n\r\n /**\r\n * The maximum number of vertices allowed for polygons generated during the\r\n * contour to polygon conversion process. [Limit: >= 3]\r\n */\r\n maxVertsPerPoly: number;\r\n\r\n /**\r\n * Sets the sampling distance to use when generating the detail mesh.\r\n * (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]\r\n */\r\n detailSampleDist: number;\r\n\r\n /**\r\n * The maximum distance the detail mesh surface should deviate from heightfield\r\n * data. (For height detail only.) [Limit: >=0] [Units: wu]\r\n */\r\n detailSampleMaxError: number;\r\n\r\n /**\r\n * If using obstacles, the navmesh must be subdivided internaly by tiles.\r\n * This member defines the tile cube side length in world units.\r\n * If no obstacles are needed, leave it undefined or 0.\r\n */\r\n tileSize?: number;\r\n\r\n /**\r\n * The size of the non-navigable border around the heightfield.\r\n */\r\n borderSize?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"INavigationEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Navigation/INavigationEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Vector3 } from \"../Maths/math\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Scene } from \"../scene\";\r\n\r\n/**\r\n * Navigation plugin interface to add navigation constrained by a navigation mesh\r\n */\r\nexport interface INavigationEnginePlugin {\r\n /**\r\n * plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void;\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n isSupported(): boolean;\r\n\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void;\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number): void;\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number;\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): IObstacle;\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): IObstacle;\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Obstacle interface\r\n */\r\nexport interface IObstacle {}\r\n\r\n/**\r\n * Crowd Interface. A Crowd is a collection of moving agents constrained by a navigation mesh\r\n */\r\nexport interface ICrowd {\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number;\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number;\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void;\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[];\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void;\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[];\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Configures an agent\r\n */\r\nexport interface IAgentParameters {\r\n /**\r\n * Agent radius. [Limit: >= 0]\r\n */\r\n radius: number;\r\n\r\n /**\r\n * Agent height. [Limit: > 0]\r\n */\r\n height: number;\r\n\r\n /**\r\n * Maximum allowed acceleration. [Limit: >= 0]\r\n */\r\n maxAcceleration: number;\r\n\r\n /**\r\n * Maximum allowed speed. [Limit: >= 0]\r\n */\r\n maxSpeed: number;\r\n\r\n /**\r\n * Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0]\r\n */\r\n collisionQueryRange: number;\r\n\r\n /**\r\n * The path visibility optimization range. [Limit: > 0]\r\n */\r\n pathOptimizationRange: number;\r\n\r\n /**\r\n * How aggressive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0]\r\n */\r\n separationWeight: number;\r\n\r\n /**\r\n * Observers will be notified when agent gets inside the virtual circle with this Radius around destination point.\r\n * Default is agent radius\r\n */\r\n reachRadius?: number;\r\n}\r\n\r\n/**\r\n * Configures the navigation mesh creation\r\n */\r\nexport interface INavMeshParameters {\r\n /**\r\n * The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n cs: number;\r\n\r\n /**\r\n * The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n ch: number;\r\n\r\n /**\r\n * The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]\r\n */\r\n walkableSlopeAngle: number;\r\n\r\n /**\r\n * Minimum floor to 'ceiling' height that will still allow the floor area to\r\n * be considered walkable. [Limit: >= 3] [Units: vx]\r\n */\r\n walkableHeight: number;\r\n\r\n /**\r\n * Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]\r\n */\r\n walkableClimb: number;\r\n\r\n /**\r\n * The distance to erode/shrink the walkable area of the heightfield away from\r\n * obstructions. [Limit: >=0] [Units: vx]\r\n */\r\n walkableRadius: number;\r\n\r\n /**\r\n * The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]\r\n */\r\n maxEdgeLen: number;\r\n\r\n /**\r\n * The maximum distance a simplified contour's border edges should deviate\r\n * the original raw contour. [Limit: >=0] [Units: vx]\r\n */\r\n maxSimplificationError: number;\r\n\r\n /**\r\n * The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]\r\n */\r\n minRegionArea: number;\r\n\r\n /**\r\n * Any regions with a span count smaller than this value will, if possible,\r\n * be merged with larger regions. [Limit: >=0] [Units: vx]\r\n */\r\n mergeRegionArea: number;\r\n\r\n /**\r\n * The maximum number of vertices allowed for polygons generated during the\r\n * contour to polygon conversion process. [Limit: >= 3]\r\n */\r\n maxVertsPerPoly: number;\r\n\r\n /**\r\n * Sets the sampling distance to use when generating the detail mesh.\r\n * (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]\r\n */\r\n detailSampleDist: number;\r\n\r\n /**\r\n * The maximum distance the detail mesh surface should deviate from heightfield\r\n * data. (For height detail only.) [Limit: >=0] [Units: wu]\r\n */\r\n detailSampleMaxError: number;\r\n\r\n /**\r\n * If using obstacles, the navmesh must be subdivided internaly by tiles.\r\n * This member defines the tile cube side length in world units.\r\n * If no obstacles are needed, leave it undefined or 0.\r\n */\r\n tileSize?: number;\r\n\r\n /**\r\n * The size of the non-navigable border around the heightfield.\r\n */\r\n borderSize?: number;\r\n}\r\n"]}
@@ -125,13 +125,23 @@ export declare class RecastJSPlugin implements INavigationEnginePlugin {
125
125
  * @param result output the resulting point along the navmesh
126
126
  */
127
127
  moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;
128
+ private _convertNavPathPoints;
128
129
  /**
129
130
  * Compute a navigation path from start to end. Returns an empty array if no path can be computed
131
+ * Path is straight.
130
132
  * @param start world position
131
133
  * @param end world position
132
134
  * @returns array containing world position composing the path
133
135
  */
134
136
  computePath(start: Vector3, end: Vector3): Vector3[];
137
+ /**
138
+ * Compute a navigation path from start to end. Returns an empty array if no path can be computed.
139
+ * Path follows navigation mesh geometry.
140
+ * @param start world position
141
+ * @param end world position
142
+ * @returns array containing world position composing the path
143
+ */
144
+ computePathSmooth(start: Vector3, end: Vector3): Vector3[];
135
145
  /**
136
146
  * Create a new Crowd so you can add agents
137
147
  * @param maxAgents the maximum agent count in the crowd
@@ -197,6 +207,16 @@ export declare class RecastJSPlugin implements INavigationEnginePlugin {
197
207
  * @returns true if plugin is supported
198
208
  */
199
209
  isSupported(): boolean;
210
+ /**
211
+ * Returns the seed used for randomized functions like `getRandomPointAround`
212
+ * @returns seed number
213
+ */
214
+ getRandomSeed(): number;
215
+ /**
216
+ * Set the seed used for randomized functions like `getRandomPointAround`
217
+ * @param seed number used as seed for random functions
218
+ */
219
+ setRandomSeed(seed: number): void;
200
220
  }
201
221
  /**
202
222
  * Recast detour crowd implementation