@babylonjs/core 7.27.0 → 7.27.2

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 (144) hide show
  1. package/Animations/animationGroup.d.ts +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Audio/audioSceneComponent.d.ts +5 -9
  4. package/Audio/audioSceneComponent.js.map +1 -1
  5. package/Bones/skeleton.d.ts +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +2 -0
  8. package/Cameras/camera.js +2 -0
  9. package/Cameras/camera.js.map +1 -1
  10. package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -0
  11. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/{abstractScene.d.ts → IAssetContainer.d.ts} +33 -6
  15. package/IAssetContainer.js +2 -0
  16. package/IAssetContainer.js.map +1 -0
  17. package/Layers/effectLayerSceneComponent.d.ts +6 -6
  18. package/Layers/effectLayerSceneComponent.js +3 -3
  19. package/Layers/effectLayerSceneComponent.js.map +1 -1
  20. package/Layers/glowLayer.d.ts +3 -3
  21. package/Layers/glowLayer.js +2 -2
  22. package/Layers/glowLayer.js.map +1 -1
  23. package/Layers/highlightLayer.d.ts +3 -3
  24. package/Layers/highlightLayer.js +2 -2
  25. package/Layers/highlightLayer.js.map +1 -1
  26. package/Layers/layerSceneComponent.d.ts +5 -5
  27. package/Layers/layerSceneComponent.js.map +1 -1
  28. package/LensFlares/lensFlareSystemSceneComponent.d.ts +6 -6
  29. package/LensFlares/lensFlareSystemSceneComponent.js +6 -6
  30. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  31. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +3 -3
  32. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -1
  34. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  35. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +2 -2
  36. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  37. package/Materials/Textures/baseTexture.d.ts +2 -2
  38. package/Materials/Textures/baseTexture.js.map +1 -1
  39. package/Materials/effectRenderer.d.ts +1 -0
  40. package/Materials/effectRenderer.js +2 -0
  41. package/Materials/effectRenderer.js.map +1 -1
  42. package/Materials/material.d.ts +2 -2
  43. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  44. package/Materials/material.decalMapConfiguration.js +1 -1
  45. package/Materials/material.decalMapConfiguration.js.map +1 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/shaderMaterial.d.ts +5 -0
  48. package/Materials/shaderMaterial.js +7 -0
  49. package/Materials/shaderMaterial.js.map +1 -1
  50. package/Maths/math.color.d.ts +20 -0
  51. package/Maths/math.color.js +41 -12
  52. package/Maths/math.color.js.map +1 -1
  53. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  54. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  55. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  56. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  57. package/Meshes/Builders/groundBuilder.js +2 -2
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  60. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  62. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  63. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  64. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  65. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  66. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  67. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  69. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  70. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  72. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  73. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  75. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  77. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  79. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  80. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  81. package/Meshes/geometry.d.ts +2 -2
  82. package/Meshes/geometry.js.map +1 -1
  83. package/Meshes/mesh.d.ts +7 -0
  84. package/Meshes/mesh.js +15 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  87. package/Meshes/meshUVSpaceRenderer.js +15 -3
  88. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  89. package/Misc/greasedLineTools.d.ts +3 -1
  90. package/Misc/greasedLineTools.js +17 -2
  91. package/Misc/greasedLineTools.js.map +1 -1
  92. package/Misc/index.d.ts +2 -0
  93. package/Misc/index.js +2 -0
  94. package/Misc/index.js.map +1 -1
  95. package/Misc/screenshotTools.js +3 -2
  96. package/Misc/screenshotTools.js.map +1 -1
  97. package/Misc/textureTools.js +20 -4
  98. package/Misc/textureTools.js.map +1 -1
  99. package/Morph/morphTargetManager.d.ts +2 -2
  100. package/Morph/morphTargetManager.js.map +1 -1
  101. package/PostProcesses/postProcess.d.ts +2 -2
  102. package/PostProcesses/postProcess.js.map +1 -1
  103. package/Probes/reflectionProbe.d.ts +5 -5
  104. package/Probes/reflectionProbe.js +3 -3
  105. package/Probes/reflectionProbe.js.map +1 -1
  106. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  107. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  108. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  109. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  110. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  111. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  112. package/Shaders/lod.fragment.js +2 -2
  113. package/Shaders/lod.fragment.js.map +1 -1
  114. package/Shaders/lodCube.fragment.js +2 -2
  115. package/Shaders/lodCube.fragment.js.map +1 -1
  116. package/Shaders/spriteMap.fragment.js +18 -6
  117. package/Shaders/spriteMap.fragment.js.map +1 -1
  118. package/Shaders/spriteMap.vertex.js +1 -1
  119. package/Shaders/spriteMap.vertex.js.map +1 -1
  120. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  121. package/ShadersWGSL/lod.fragment.js +11 -0
  122. package/ShadersWGSL/lod.fragment.js.map +1 -0
  123. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  124. package/ShadersWGSL/lodCube.fragment.js +30 -0
  125. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  126. package/Sprites/spriteMap.d.ts +16 -0
  127. package/Sprites/spriteMap.js +17 -0
  128. package/Sprites/spriteMap.js.map +1 -1
  129. package/assetContainer.d.ts +143 -3
  130. package/assetContainer.js +129 -8
  131. package/assetContainer.js.map +1 -1
  132. package/index.d.ts +0 -1
  133. package/index.js +0 -1
  134. package/index.js.map +1 -1
  135. package/node.d.ts +2 -2
  136. package/node.js.map +1 -1
  137. package/package.json +1 -1
  138. package/scene.d.ts +103 -14
  139. package/scene.js +170 -71
  140. package/scene.js.map +1 -1
  141. package/sceneComponent.d.ts +3 -3
  142. package/sceneComponent.js.map +1 -1
  143. package/abstractScene.js +0 -117
  144. package/abstractScene.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAmBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAY,EAAE,OAAmC;QACvE,MAAM,OAAO,GAAG;YACZ,gCAAgC,yEAAiE,GAAG;YACpG,mCAAmC,4EAAoE,GAAG;YAC1G,kBAAkB,+CAAuC,GAAG;YAC5D,kBAAkB,+CAAuC,GAAG;YAC5D,uBAAuB,oDAA4C,GAAG;SACzE,CAAC;QACF,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAElF,KAAK,CAAC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAE1F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAC3C,UAAU,CAAC,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;SACjE;aAAM;YACH,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,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IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,0BAA0B,CAAC,eAAe,CAAC,CAAC;QAClH,0BAA0B,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;QAEnG,IAAI,0BAA0B,CAAC,MAAM,EAAE;YACnC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,IAAI,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrK;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,YAAY,IAAI,IAAI,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,4BAA4B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\n\r\nimport { ShaderMaterial } from \"../shaderMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\n\r\nimport \"../../Shaders/greasedLine.fragment\";\r\nimport \"../../Shaders/greasedLine.vertex\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture: Nullable<RawTexture> = null;\r\n private _cameraFacing: boolean;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n const defines = [\r\n `COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,\r\n `COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,\r\n `COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,\r\n `COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,\r\n `COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,\r\n ];\r\n const attributes = [\"position\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"];\r\n\r\n scene.useRightHandedSystem && defines.push(\"GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\");\r\n\r\n if (options.cameraFacing) {\r\n defines.push(\"GREASED_LINE_CAMERA_FACING\");\r\n attributes.push(\"grl_previousAndSide\", \"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n attributes.push(\"grl_counters\");\r\n }\r\n\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n attributes,\r\n uniforms: [\r\n \"world\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"projection\",\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n ],\r\n samplers: [\"grlColors\"],\r\n defines,\r\n }\r\n );\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const engine = scene.getEngine();\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width\r\n ? options.width\r\n : options.sizeAttenuation && options.cameraFacing\r\n ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\r\n : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture;\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n if (this._colors) {\r\n if (this.useColors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, this._colors, this.colorsSampling, scene);\r\n }\r\n }\r\n\r\n engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this._colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this._colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, colors, this.colorsSampling, this.getScene());\r\n }\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n get colorsTexture() {\r\n return (this._colorsTexture as RawTexture) ?? null;\r\n }\r\n\r\n /**\r\n * Sets the colorsTexture\r\n */\r\n set colorsTexture(value: RawTexture) {\r\n this._colorsTexture = value;\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this.color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n cameraFacing: this._cameraFacing,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n // TODO: super.parse?\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n greasedLineMaterialOptions.color && (this.color = greasedLineMaterialOptions.color);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors, this.colorsSampling, this.getScene());\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this._cameraFacing = greasedLineMaterialOptions.cameraFacing ?? true;\r\n this.setDefine(\"GREASED_LINE_CAMERA_FACING\", this._cameraFacing);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAmBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAY,EAAE,OAAmC;QACvE,MAAM,OAAO,GAAG;YACZ,gCAAgC,yEAAiE,GAAG;YACpG,mCAAmC,4EAAoE,GAAG;YAC1G,kBAAkB,+CAAuC,GAAG;YAC5D,kBAAkB,+CAAuC,GAAG;YAC5D,uBAAuB,oDAA4C,GAAG;SACzE,CAAC;QACF,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAElF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AAC;QAChG,0BAA0B,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;QAChG,0BAA0B,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;QACnG,0BAA0B,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;QACpF,0BAA0B,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,0BAA0B,CAAC,eAAe,CAAC,CAAC;QAClH,0BAA0B,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;QAEnG,IAAI,0BAA0B,CAAC,MAAM,EAAE;YACnC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,IAAI,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrK;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,YAAY,IAAI,IAAI,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,4BAA4B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\n\r\nimport { ShaderMaterial } from \"../shaderMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\n\r\nimport \"../../Shaders/greasedLine.fragment\";\r\nimport \"../../Shaders/greasedLine.vertex\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture: Nullable<RawTexture> = null;\r\n private _cameraFacing: boolean;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n const defines = [\r\n `COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,\r\n `COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,\r\n `COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,\r\n `COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,\r\n `COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,\r\n ];\r\n const attributes = [\"position\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"];\r\n\r\n scene.useRightHandedSystem && defines.push(\"GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\");\r\n\r\n if (options.cameraFacing) {\r\n defines.push(\"GREASED_LINE_CAMERA_FACING\");\r\n attributes.push(\"grl_previousAndSide\", \"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n attributes.push(\"grl_counters\");\r\n }\r\n\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n attributes,\r\n uniforms: [\r\n \"world\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"projection\",\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n ],\r\n samplers: [\"grlColors\"],\r\n defines,\r\n }\r\n );\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const engine = scene.getEngine();\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width\r\n ? options.width\r\n : options.sizeAttenuation && options.cameraFacing\r\n ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\r\n : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture;\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n if (this._colors) {\r\n if (this.useColors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, this._colors, this.colorsSampling, scene);\r\n }\r\n }\r\n\r\n engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this._colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this._colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, colors, this.colorsSampling, this.getScene());\r\n }\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n get colorsTexture() {\r\n return (this._colorsTexture as RawTexture) ?? null;\r\n }\r\n\r\n /**\r\n * Sets the colorsTexture\r\n */\r\n set colorsTexture(value: RawTexture) {\r\n this._colorsTexture = value;\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n cameraFacing: this._cameraFacing,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n // TODO: super.parse?\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n greasedLineMaterialOptions.color && (this.color = greasedLineMaterialOptions.color);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors, this.colorsSampling, this.getScene());\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this._cameraFacing = greasedLineMaterialOptions.cameraFacing ?? true;\r\n this.setDefine(\"GREASED_LINE_CAMERA_FACING\", this._cameraFacing);\r\n }\r\n}\r\n"]}
@@ -1,8 +1,8 @@
1
1
  import type { Scene } from "../../../scene";
2
2
  import type { ISceneComponent } from "../../../sceneComponent";
3
3
  import type { ProceduralTexture } from "./proceduralTexture";
4
- declare module "../../../abstractScene" {
5
- interface AbstractScene {
4
+ declare module "../../../scene" {
5
+ interface Scene {
6
6
  /**
7
7
  * The list of procedural textures added to the scene
8
8
  * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/proceduralTextures
@@ -1 +1 @@
1
- {"version":3,"file":"proceduralTextureSceneComponent.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAalE;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAWxC;;;OAGG;IACH,YAAY,KAAY;QAdxB;;WAEG;QACa,SAAI,GAAG,uBAAuB,CAAC,sBAAsB,CAAC;QAYlE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,kBAAkB,GAAG,EAAyB,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,QAAQ;QACX,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,uBAAuB,CAAC,kCAAkC,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACnI,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,sBAAsB;IAC1B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,sBAAsB;IAC1B,CAAC;IAEO,YAAY;QAChB,IAAI,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE;YACtC,KAAK,CAAC,uBAAuB,CAAC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC/F,KAAK,IAAI,eAAe,GAAG,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE;gBACrG,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;gBACzE,IAAI,iBAAiB,CAAC,aAAa,EAAE,EAAE;oBACnC,iBAAiB,CAAC,MAAM,EAAE,CAAC;iBAC9B;aACJ;YACD,KAAK,CAAC,qBAAqB,CAAC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAChG;IACL,CAAC;CACJ","sourcesContent":["import { Tools } from \"../../../Misc/tools\";\r\nimport type { Scene } from \"../../../scene\";\r\nimport type { ISceneComponent } from \"../../../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../../../sceneComponent\";\r\n\r\nimport type { ProceduralTexture } from \"./proceduralTexture\";\r\n\r\ndeclare module \"../../../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of procedural textures added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/proceduralTextures\r\n */\r\n proceduralTextures: Array<ProceduralTexture>;\r\n }\r\n}\r\n/**\r\n * Defines the Procedural Texture scene component responsible to manage any Procedural Texture\r\n * in a given scene.\r\n */\r\nexport class ProceduralTextureSceneComponent implements ISceneComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_PROCEDURALTEXTURE;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n this.scene.proceduralTextures = [] as ProceduralTexture[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._beforeClearStage.registerStep(SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing to do here.\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n // Nothing to do here.\r\n }\r\n\r\n private _beforeClear(): void {\r\n if (this.scene.proceduralTexturesEnabled) {\r\n Tools.StartPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n for (let proceduralIndex = 0; proceduralIndex < this.scene.proceduralTextures.length; proceduralIndex++) {\r\n const proceduralTexture = this.scene.proceduralTextures[proceduralIndex];\r\n if (proceduralTexture._shouldRender()) {\r\n proceduralTexture.render();\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"proceduralTextureSceneComponent.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAalE;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAWxC;;;OAGG;IACH,YAAY,KAAY;QAdxB;;WAEG;QACa,SAAI,GAAG,uBAAuB,CAAC,sBAAsB,CAAC;QAYlE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,kBAAkB,GAAG,EAAyB,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,QAAQ;QACX,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,uBAAuB,CAAC,kCAAkC,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACnI,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,sBAAsB;IAC1B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,sBAAsB;IAC1B,CAAC;IAEO,YAAY;QAChB,IAAI,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE;YACtC,KAAK,CAAC,uBAAuB,CAAC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC/F,KAAK,IAAI,eAAe,GAAG,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE;gBACrG,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;gBACzE,IAAI,iBAAiB,CAAC,aAAa,EAAE,EAAE;oBACnC,iBAAiB,CAAC,MAAM,EAAE,CAAC;iBAC9B;aACJ;YACD,KAAK,CAAC,qBAAqB,CAAC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAChG;IACL,CAAC;CACJ","sourcesContent":["import { Tools } from \"../../../Misc/tools\";\r\nimport type { Scene } from \"../../../scene\";\r\nimport type { ISceneComponent } from \"../../../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../../../sceneComponent\";\r\n\r\nimport type { ProceduralTexture } from \"./proceduralTexture\";\r\n\r\ndeclare module \"../../../scene\" {\r\n export interface Scene {\r\n /**\r\n * The list of procedural textures added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/proceduralTextures\r\n */\r\n proceduralTextures: Array<ProceduralTexture>;\r\n }\r\n}\r\n/**\r\n * Defines the Procedural Texture scene component responsible to manage any Procedural Texture\r\n * in a given scene.\r\n */\r\nexport class ProceduralTextureSceneComponent implements ISceneComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_PROCEDURALTEXTURE;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n this.scene.proceduralTextures = [] as ProceduralTexture[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._beforeClearStage.registerStep(SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing to do here.\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n // Nothing to do here.\r\n }\r\n\r\n private _beforeClear(): void {\r\n if (this.scene.proceduralTexturesEnabled) {\r\n Tools.StartPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n for (let proceduralIndex = 0; proceduralIndex < this.scene.proceduralTextures.length; proceduralIndex++) {\r\n const proceduralTexture = this.scene.proceduralTextures[proceduralIndex];\r\n if (proceduralTexture._shouldRender()) {\r\n proceduralTexture.render();\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n }\r\n }\r\n}\r\n"]}
@@ -7,8 +7,8 @@ import type { IAnimatable } from "../../Animations/animatable.interface";
7
7
  import "../../Misc/fileTools";
8
8
  import type { AbstractEngine } from "../../Engines/abstractEngine";
9
9
  import { ThinTexture } from "./thinTexture";
10
- import type { AbstractScene } from "../../abstractScene";
11
10
  import type { Animation } from "../../Animations/animation";
11
+ import type { IAssetContainer } from "../../IAssetContainer.js";
12
12
  /**
13
13
  * Base class of all the textures in babylon.
14
14
  * It groups all the common properties the materials, post process, lights... might need
@@ -231,7 +231,7 @@ export declare class BaseTexture extends ThinTexture implements IAnimatable {
231
231
  */
232
232
  get isBlocking(): boolean;
233
233
  /** @internal */
234
- _parentContainer: Nullable<AbstractScene>;
234
+ _parentContainer: Nullable<IAssetContainer>;
235
235
  protected _loadingError: boolean;
236
236
  protected _errorObject?: {
237
237
  message?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"baseTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/baseTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB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B,CAAC;qDACI;AAyB1B;IADN,SAAS,EAAE;0CACK;AAGP;IADT,SAAS,CAAC,kBAAkB,CAAC;sDACE;AAOzB;IADN,SAAS,EAAE;yDACuB;AAsBzB;IADT,SAAS,CAAC,iBAAiB,CAAC;qDACgC;AAyC7D;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AAae;IADf,SAAS,EAAE;0CAC+C;AAQ3C;IADf,SAAS,EAAE;8DACgF;AAQ5F;IADC,SAAS,EAAE;yCAOX;AAeD;IADC,SAAS,EAAE;uCAOX;AAeD;IADC,SAAS,EAAE;4CAOX;AAmBD;IADC,SAAS,EAAE;6CAWX;AA6CM;IADN,SAAS,EAAE;4CACW;AAahB;IADN,SAAS,EAAE;oDACmB;AAM/B;IADC,SAAS,EAAE;sDAOX;AAWD;IADC,SAAS,EAAE;qDAOX;AAaD;IADC,SAAS,EAAE;oDAOX;AAaD;IADC,kBAAkB,EAAE;oDAOpB;AAWM;IADN,SAAS,EAAE;mDACkB","sourcesContent":["import { serialize, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\n\r\nimport \"../../Misc/fileTools\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { ThinTexture } from \"./thinTexture\";\r\nimport type { AbstractScene } from \"../../abstractScene\";\r\n\r\nimport type { Animation } from \"../../Animations/animation\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nexport class BaseTexture extends ThinTexture implements IAnimatable {\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Define the name of the texture.\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /** @internal */\r\n public _internalMetadata: any;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n @serialize(\"hasAlpha\")\r\n private _hasAlpha = false;\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n public set hasAlpha(value: boolean) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get hasAlpha(): boolean {\r\n return this._hasAlpha;\r\n }\r\n\r\n @serialize(\"getAlphaFromRGB\")\r\n private _getAlphaFromRGB = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n public set getAlphaFromRGB(value: boolean) {\r\n if (this._getAlphaFromRGB === value) {\r\n return;\r\n }\r\n this._getAlphaFromRGB = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get getAlphaFromRGB(): boolean {\r\n return this._getAlphaFromRGB;\r\n }\r\n\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n @serialize()\r\n public level = 1;\r\n\r\n @serialize(\"coordinatesIndex\")\r\n protected _coordinatesIndex = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation.\r\n * (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)\r\n */\r\n @serialize()\r\n public optimizeUVAllocation = true;\r\n\r\n /**\r\n * Define the UV channel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n public set coordinatesIndex(value: number) {\r\n if (this._coordinatesIndex === value) {\r\n return;\r\n }\r\n this._coordinatesIndex = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesIndex(): number {\r\n return this._coordinatesIndex;\r\n }\r\n\r\n @serialize(\"coordinatesMode\")\r\n protected _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n public override set coordinatesMode(value: number) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public override get coordinatesMode(): number {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapU() {\r\n return this._wrapU;\r\n }\r\n public override set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapV() {\r\n return this._wrapV;\r\n }\r\n public override set wrapV(value: number) {\r\n this._wrapV = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n @serialize()\r\n public override anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n\r\n /** @internal */\r\n public _isCube = false;\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get isCube(): boolean {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n\r\n return this._texture.isCube;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set isCube(value: boolean) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n } else {\r\n this._texture.isCube = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is3D(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is3D;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is3D(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is3D = value;\r\n }\r\n\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is2DArray(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is2DArray;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is2DArray(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is2DArray = value;\r\n }\r\n\r\n /** @internal */\r\n protected _gammaSpace = true;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n @serialize()\r\n public get gammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\r\n }\r\n\r\n public set gammaSpace(gamma: boolean) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n\r\n this._gammaSpace = gamma;\r\n } else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n public get isRGBD(): boolean {\r\n return this._texture != null && this._texture._isRGBD;\r\n }\r\n public set isRGBD(value: boolean) {\r\n if (value === this.isRGBD) {\r\n return;\r\n }\r\n\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n @serialize()\r\n public invertZ = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n @serialize()\r\n public lodLevelInAlpha = false;\r\n\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationOffset(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationOffset(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationScale(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationScale(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n @serialize()\r\n public get linearSpecularLOD(): boolean {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n\r\n return false;\r\n }\r\n public set linearSpecularLOD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n }\r\n\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n @serializeAsTexture()\r\n public get irradianceTexture(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n\r\n return null;\r\n }\r\n public set irradianceTexture(value: Nullable<BaseTexture>) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n @serialize()\r\n public isRenderTarget = false;\r\n\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n public get uid(): string {\r\n if (!this._uid) {\r\n this._uid = RandomGUID();\r\n }\r\n return this._uid;\r\n }\r\n\r\n /** @internal */\r\n public _prefiltered: boolean = false;\r\n /** @internal */\r\n public _forceSerialize: boolean = false;\r\n\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n public override toString(): string {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"BaseTexture\";\r\n }\r\n\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n public onDisposeObservable = new Observable<BaseTexture>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n protected _scene: Nullable<Scene> = null;\r\n\r\n /** @internal */\r\n private _uid: Nullable<string> = null;\r\n\r\n /**\r\n * Define if the texture is preventing a material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n public get isBlocking(): boolean {\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n protected _loadingError: boolean = false;\r\n protected _errorObject?: {\r\n message?: string;\r\n exception?: any;\r\n };\r\n\r\n /**\r\n * Was there any loading error?\r\n */\r\n public get loadingError(): boolean {\r\n return this._loadingError;\r\n }\r\n\r\n /**\r\n * If a loading error occurred this object will be populated with information about the error.\r\n */\r\n public get errorObject():\r\n | {\r\n message?: string;\r\n exception?: any;\r\n }\r\n | undefined {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture belongs to\r\n * @param internalTexture Define the internal texture associated with the texture\r\n */\r\n constructor(sceneOrEngine?: Nullable<Scene | AbstractEngine>, internalTexture: Nullable<InternalTexture> = null) {\r\n super(null);\r\n\r\n if (sceneOrEngine) {\r\n if (BaseTexture._IsScene(sceneOrEngine)) {\r\n this._scene = sceneOrEngine;\r\n } else {\r\n this._engine = sceneOrEngine;\r\n }\r\n } else {\r\n this._scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n this._engine = this._scene.getEngine();\r\n }\r\n\r\n this._texture = internalTexture;\r\n\r\n this._uid = null;\r\n }\r\n\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /** @internal */\r\n protected _getEngine(): Nullable<AbstractEngine> {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for instance.\r\n * @returns the transformation matrix\r\n */\r\n public getTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\r\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\r\n * @returns The refraction matrix\r\n */\r\n public getRefractionTextureMatrix(): Matrix {\r\n return this.getReflectionTextureMatrix();\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready, not blocking or if there was an error loading the texture\r\n */\r\n public isReadyOrNotBlocking(): boolean {\r\n return !this.isBlocking || this.isReady() || this.loadingError;\r\n }\r\n\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public scale(ratio: number): void {}\r\n\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n public get canRescale(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture> {\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\r\n\r\n const texturesCache = engine.getLoadedTexturesCache();\r\n for (let index = 0; index < texturesCache.length; index++) {\r\n const texturesCacheEntry = texturesCache[index];\r\n\r\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n if (isCube === undefined || isCube === texturesCacheEntry.isCube) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(_fromContextLost = false): void {}\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n public get textureType(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n return this._texture.type !== undefined ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n public get textureFormat(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n return this._texture.format !== undefined ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n protected _markAllSubMeshesAsTexturesDirty() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\r\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param x defines the region x coordinates to start reading from (default to 0)\r\n * @param y defines the region y coordinates to start reading from (default to 0)\r\n * @param width defines the region width to read from (default to the texture size at level)\r\n * @param height defines the region width to read from (default to the texture size at level)\r\n * @returns The Array buffer promise containing the pixels data.\r\n */\r\n public readPixels(\r\n faceIndex = 0,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0,\r\n width = Number.MAX_VALUE,\r\n height = Number.MAX_VALUE\r\n ): Nullable<Promise<ArrayBufferView>> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let maxWidth = size.width;\r\n let maxHeight = size.height;\r\n if (level !== 0) {\r\n maxWidth = maxWidth / Math.pow(2, level);\r\n maxHeight = maxHeight / Math.pow(2, level);\r\n maxWidth = Math.round(maxWidth);\r\n maxHeight = Math.round(maxHeight);\r\n }\r\n\r\n width = Math.min(maxWidth, width);\r\n height = Math.min(maxHeight, height);\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\r\n }\r\n\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _readPixelsSync(faceIndex = 0, level = 0, buffer: Nullable<ArrayBufferView> = null, flushRenderer = true, noDataConversion = false): Nullable<ArrayBufferView> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let width = size.width;\r\n let height = size.height;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\r\n }\r\n\r\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureHigh(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureMid(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureLow(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n\r\n // Remove from scene\r\n this._scene.removePendingData(this);\r\n const index = this._scene.textures.indexOf(this);\r\n\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.textures.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.textures.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @param allowEmptyName True to force serialization even if name is empty. Default: false\r\n * @returns the JSON representation of the texture\r\n */\r\n public serialize(allowEmptyName = false): any {\r\n if (!this.name && !allowEmptyName) {\r\n return null;\r\n }\r\n\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n public static WhenAllReady(textures: BaseTexture[], callback: () => void): void {\r\n let numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n\r\n for (let i = 0; i < textures.length; i++) {\r\n const texture = textures[i];\r\n\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n } else {\r\n const onLoadObservable = (texture as any).onLoadObservable as Observable<BaseTexture>;\r\n\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(() => {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n } else {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _IsScene(sceneOrEngine: Scene | AbstractEngine): sceneOrEngine is Scene {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"baseTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/baseTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,SAAS,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WpB;IADP,SAAS,CAAC,UAAU,CAAC;8CACI;AAoBlB;IADP,SAAS,CAAC,iBAAiB,CAAC;qDACI;AAyB1B;IADN,SAAS,EAAE;0CACK;AAGP;IADT,SAAS,CAAC,kBAAkB,CAAC;sDACE;AAOzB;IADN,SAAS,EAAE;yDACuB;AAsBzB;IADT,SAAS,CAAC,iBAAiB,CAAC;qDACgC;AAyC7D;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AAae;IADf,SAAS,EAAE;0CAC+C;AAQ3C;IADf,SAAS,EAAE;8DACgF;AAQ5F;IADC,SAAS,EAAE;yCAOX;AAeD;IADC,SAAS,EAAE;uCAOX;AAeD;IADC,SAAS,EAAE;4CAOX;AAmBD;IADC,SAAS,EAAE;6CAWX;AA6CM;IADN,SAAS,EAAE;4CACW;AAahB;IADN,SAAS,EAAE;oDACmB;AAM/B;IADC,SAAS,EAAE;sDAOX;AAWD;IADC,SAAS,EAAE;qDAOX;AAaD;IADC,SAAS,EAAE;oDAOX;AAaD;IADC,kBAAkB,EAAE;oDAOpB;AAWM;IADN,SAAS,EAAE;mDACkB","sourcesContent":["import { serialize, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\n\r\nimport \"../../Misc/fileTools\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { ThinTexture } from \"./thinTexture\";\r\n\r\nimport type { Animation } from \"../../Animations/animation\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nexport class BaseTexture extends ThinTexture implements IAnimatable {\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Define the name of the texture.\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /** @internal */\r\n public _internalMetadata: any;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n @serialize(\"hasAlpha\")\r\n private _hasAlpha = false;\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n public set hasAlpha(value: boolean) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get hasAlpha(): boolean {\r\n return this._hasAlpha;\r\n }\r\n\r\n @serialize(\"getAlphaFromRGB\")\r\n private _getAlphaFromRGB = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n public set getAlphaFromRGB(value: boolean) {\r\n if (this._getAlphaFromRGB === value) {\r\n return;\r\n }\r\n this._getAlphaFromRGB = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get getAlphaFromRGB(): boolean {\r\n return this._getAlphaFromRGB;\r\n }\r\n\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n @serialize()\r\n public level = 1;\r\n\r\n @serialize(\"coordinatesIndex\")\r\n protected _coordinatesIndex = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation.\r\n * (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)\r\n */\r\n @serialize()\r\n public optimizeUVAllocation = true;\r\n\r\n /**\r\n * Define the UV channel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n public set coordinatesIndex(value: number) {\r\n if (this._coordinatesIndex === value) {\r\n return;\r\n }\r\n this._coordinatesIndex = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesIndex(): number {\r\n return this._coordinatesIndex;\r\n }\r\n\r\n @serialize(\"coordinatesMode\")\r\n protected _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n public override set coordinatesMode(value: number) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public override get coordinatesMode(): number {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapU() {\r\n return this._wrapU;\r\n }\r\n public override set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapV() {\r\n return this._wrapV;\r\n }\r\n public override set wrapV(value: number) {\r\n this._wrapV = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n @serialize()\r\n public override anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n\r\n /** @internal */\r\n public _isCube = false;\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get isCube(): boolean {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n\r\n return this._texture.isCube;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set isCube(value: boolean) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n } else {\r\n this._texture.isCube = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is3D(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is3D;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is3D(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is3D = value;\r\n }\r\n\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is2DArray(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is2DArray;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is2DArray(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is2DArray = value;\r\n }\r\n\r\n /** @internal */\r\n protected _gammaSpace = true;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n @serialize()\r\n public get gammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\r\n }\r\n\r\n public set gammaSpace(gamma: boolean) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n\r\n this._gammaSpace = gamma;\r\n } else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n public get isRGBD(): boolean {\r\n return this._texture != null && this._texture._isRGBD;\r\n }\r\n public set isRGBD(value: boolean) {\r\n if (value === this.isRGBD) {\r\n return;\r\n }\r\n\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n @serialize()\r\n public invertZ = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n @serialize()\r\n public lodLevelInAlpha = false;\r\n\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationOffset(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationOffset(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationScale(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationScale(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n @serialize()\r\n public get linearSpecularLOD(): boolean {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n\r\n return false;\r\n }\r\n public set linearSpecularLOD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n }\r\n\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n @serializeAsTexture()\r\n public get irradianceTexture(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n\r\n return null;\r\n }\r\n public set irradianceTexture(value: Nullable<BaseTexture>) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n @serialize()\r\n public isRenderTarget = false;\r\n\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n public get uid(): string {\r\n if (!this._uid) {\r\n this._uid = RandomGUID();\r\n }\r\n return this._uid;\r\n }\r\n\r\n /** @internal */\r\n public _prefiltered: boolean = false;\r\n /** @internal */\r\n public _forceSerialize: boolean = false;\r\n\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n public override toString(): string {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"BaseTexture\";\r\n }\r\n\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n public onDisposeObservable = new Observable<BaseTexture>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n protected _scene: Nullable<Scene> = null;\r\n\r\n /** @internal */\r\n private _uid: Nullable<string> = null;\r\n\r\n /**\r\n * Define if the texture is preventing a material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n public get isBlocking(): boolean {\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n protected _loadingError: boolean = false;\r\n protected _errorObject?: {\r\n message?: string;\r\n exception?: any;\r\n };\r\n\r\n /**\r\n * Was there any loading error?\r\n */\r\n public get loadingError(): boolean {\r\n return this._loadingError;\r\n }\r\n\r\n /**\r\n * If a loading error occurred this object will be populated with information about the error.\r\n */\r\n public get errorObject():\r\n | {\r\n message?: string;\r\n exception?: any;\r\n }\r\n | undefined {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture belongs to\r\n * @param internalTexture Define the internal texture associated with the texture\r\n */\r\n constructor(sceneOrEngine?: Nullable<Scene | AbstractEngine>, internalTexture: Nullable<InternalTexture> = null) {\r\n super(null);\r\n\r\n if (sceneOrEngine) {\r\n if (BaseTexture._IsScene(sceneOrEngine)) {\r\n this._scene = sceneOrEngine;\r\n } else {\r\n this._engine = sceneOrEngine;\r\n }\r\n } else {\r\n this._scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n this._engine = this._scene.getEngine();\r\n }\r\n\r\n this._texture = internalTexture;\r\n\r\n this._uid = null;\r\n }\r\n\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /** @internal */\r\n protected _getEngine(): Nullable<AbstractEngine> {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for instance.\r\n * @returns the transformation matrix\r\n */\r\n public getTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\r\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\r\n * @returns The refraction matrix\r\n */\r\n public getRefractionTextureMatrix(): Matrix {\r\n return this.getReflectionTextureMatrix();\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready, not blocking or if there was an error loading the texture\r\n */\r\n public isReadyOrNotBlocking(): boolean {\r\n return !this.isBlocking || this.isReady() || this.loadingError;\r\n }\r\n\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public scale(ratio: number): void {}\r\n\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n public get canRescale(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture> {\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\r\n\r\n const texturesCache = engine.getLoadedTexturesCache();\r\n for (let index = 0; index < texturesCache.length; index++) {\r\n const texturesCacheEntry = texturesCache[index];\r\n\r\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n if (isCube === undefined || isCube === texturesCacheEntry.isCube) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(_fromContextLost = false): void {}\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n public get textureType(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n return this._texture.type !== undefined ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n public get textureFormat(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n return this._texture.format !== undefined ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n protected _markAllSubMeshesAsTexturesDirty() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\r\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param x defines the region x coordinates to start reading from (default to 0)\r\n * @param y defines the region y coordinates to start reading from (default to 0)\r\n * @param width defines the region width to read from (default to the texture size at level)\r\n * @param height defines the region width to read from (default to the texture size at level)\r\n * @returns The Array buffer promise containing the pixels data.\r\n */\r\n public readPixels(\r\n faceIndex = 0,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0,\r\n width = Number.MAX_VALUE,\r\n height = Number.MAX_VALUE\r\n ): Nullable<Promise<ArrayBufferView>> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let maxWidth = size.width;\r\n let maxHeight = size.height;\r\n if (level !== 0) {\r\n maxWidth = maxWidth / Math.pow(2, level);\r\n maxHeight = maxHeight / Math.pow(2, level);\r\n maxWidth = Math.round(maxWidth);\r\n maxHeight = Math.round(maxHeight);\r\n }\r\n\r\n width = Math.min(maxWidth, width);\r\n height = Math.min(maxHeight, height);\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\r\n }\r\n\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _readPixelsSync(faceIndex = 0, level = 0, buffer: Nullable<ArrayBufferView> = null, flushRenderer = true, noDataConversion = false): Nullable<ArrayBufferView> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let width = size.width;\r\n let height = size.height;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\r\n }\r\n\r\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureHigh(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureMid(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureLow(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n\r\n // Remove from scene\r\n this._scene.removePendingData(this);\r\n const index = this._scene.textures.indexOf(this);\r\n\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.textures.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.textures.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @param allowEmptyName True to force serialization even if name is empty. Default: false\r\n * @returns the JSON representation of the texture\r\n */\r\n public serialize(allowEmptyName = false): any {\r\n if (!this.name && !allowEmptyName) {\r\n return null;\r\n }\r\n\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n public static WhenAllReady(textures: BaseTexture[], callback: () => void): void {\r\n let numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n\r\n for (let i = 0; i < textures.length; i++) {\r\n const texture = textures[i];\r\n\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n } else {\r\n const onLoadObservable = (texture as any).onLoadObservable as Observable<BaseTexture>;\r\n\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(() => {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n } else {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _IsScene(sceneOrEngine: Scene | AbstractEngine): sceneOrEngine is Scene {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n }\r\n}\r\n"]}
@@ -6,6 +6,7 @@ import { Effect } from "./effect";
6
6
  import { DrawWrapper } from "./drawWrapper";
7
7
  import type { IRenderTargetTexture, RenderTargetWrapper } from "../Engines/renderTargetWrapper";
8
8
  import type { ShaderLanguage } from "./shaderLanguage";
9
+ import "../Shaders/postprocess.vertex";
9
10
  /**
10
11
  * Effect Render Options
11
12
  */
@@ -4,6 +4,8 @@ import { Viewport } from "../Maths/math.viewport.js";
4
4
  import { Observable } from "../Misc/observable.js";
5
5
  import { Effect } from "./effect.js";
6
6
  import { DrawWrapper } from "./drawWrapper.js";
7
+ // Prevents ES6 issue if not imported.
8
+ import "../Shaders/postprocess.vertex.js";
7
9
  // Fullscreen quad buffers by default.
8
10
  const defaultOptions = {
9
11
  positions: [1, 1, -1, 1, -1, -1, 1, -1],
@@ -1 +1 @@
1
- {"version":3,"file":"effectRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/effectRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkB5C,sCAAsC;AACtC,MAAM,cAAc,GAAG;IACnB,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,cAAc;IAevB;;;;OAIG;IACH,YAAY,MAAsB,EAAE,UAAkC,cAAc;QAX5E,wBAAmB,GAAG,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAYnD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,cAAc,CAAC,SAAS,CAAC;QAChE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IA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UAAU,CAAC,EAC9C,YAAY,EACZ,eAAe,CAAC,YAAY,EAC5B,OAAO,EACP,SAAS,EACT,eAAe,CAAC,UAAU,EAC1B,SAAS,EACT,SAAS,EACT,eAAe,CAAC,cAAc,EAC9B,eAAe,CAAC,yBAAyB,CAC5C,CAAC;SACL;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CACpB,UAAU,EACV,eAAe,CAAC,cAAc,IAAI,CAAC,UAAU,CAAC,EAC9C,YAAY,EACZ,eAAe,CAAC,YAAY,EAC5B,eAAe,CAAC,MAAM,EACtB,OAAO,EACP,SAAS,EACT,eAAe,CAAC,UAAU,EAC1B,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,CAAC,cAAc,EAC9B,eAAe,CAAC,yBAAyB,CAC5C,CAAC;YAEF,IAAI,CAAC,0BAA0B,GAAG,eAAe,CAAC,MAAM,CAAC,2BAA2B,CAAC,GAAG,CAAC,GAAG,EAAE;gBAC1F,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,oHAAoH;gBACzJ,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YACjC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,WAAoB,KAAK;QACpC,IAAI,IAAI,CAAC,0BAA0B,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC5F,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;SAC1C;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Effect } from \"./effect\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { DrawWrapper } from \"./drawWrapper\";\r\nimport type { IRenderTargetTexture, RenderTargetWrapper } from \"../Engines/renderTargetWrapper\";\r\nimport type { ShaderLanguage } from \"./shaderLanguage\";\r\n\r\n/**\r\n * Effect Render Options\r\n */\r\nexport interface IEffectRendererOptions {\r\n /**\r\n * Defines the vertices positions.\r\n */\r\n positions?: number[];\r\n /**\r\n * Defines the indices.\r\n */\r\n indices?: number[];\r\n}\r\n\r\n// Fullscreen quad buffers by default.\r\nconst defaultOptions = {\r\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\r\n indices: [0, 1, 2, 0, 2, 3],\r\n};\r\n\r\n/**\r\n * Helper class to render one or more effects.\r\n * You can access the previous rendering in your shader by declaring a sampler named textureSampler\r\n */\r\nexport class EffectRenderer {\r\n /**\r\n * The engine the effect renderer has been created for.\r\n */\r\n public readonly engine: AbstractEngine;\r\n\r\n private _vertexBuffers: { [key: string]: VertexBuffer };\r\n private _indexBuffer: DataBuffer;\r\n\r\n private _fullscreenViewport = new Viewport(0, 0, 1, 1);\r\n private _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n private _savedStateDepthTest: boolean;\r\n private _savedStateStencilTest: boolean;\r\n\r\n /**\r\n * Creates an effect renderer\r\n * @param engine the engine to use for rendering\r\n * @param options defines the options of the effect renderer\r\n */\r\n constructor(engine: AbstractEngine, options: IEffectRendererOptions = defaultOptions) {\r\n const positions = options.positions ?? defaultOptions.positions;\r\n const indices = options.indices ?? defaultOptions.indices;\r\n\r\n this.engine = engine;\r\n this._vertexBuffers = {\r\n [VertexBuffer.PositionKind]: new VertexBuffer(engine, positions, VertexBuffer.PositionKind, false, false, 2),\r\n };\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n\r\n this._onContextRestoredObserver = engine.onContextRestoredObservable.add(() => {\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n\r\n for (const key in this._vertexBuffers) {\r\n const vertexBuffer = this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Sets the current viewport in normalized coordinates 0-1\r\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\r\n */\r\n public setViewport(viewport = this._fullscreenViewport): void {\r\n this.engine.setViewport(viewport);\r\n }\r\n\r\n /**\r\n * Binds the embedded attributes buffer to the effect.\r\n * @param effect Defines the effect to bind the attributes for\r\n */\r\n public bindBuffers(effect: Effect): void {\r\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n }\r\n\r\n /**\r\n * Sets the current effect wrapper to use during draw.\r\n * The effect needs to be ready before calling this api.\r\n * This also sets the default full screen position attribute.\r\n * @param effectWrapper Defines the effect to draw with\r\n */\r\n public applyEffectWrapper(effectWrapper: EffectWrapper): void {\r\n this.engine.setState(true);\r\n this.engine.depthCullingState.depthTest = false;\r\n this.engine.stencilState.stencilTest = false;\r\n this.engine.enableEffect(effectWrapper._drawWrapper);\r\n this.bindBuffers(effectWrapper.effect);\r\n effectWrapper.onApplyObservable.notifyObservers({});\r\n }\r\n\r\n /**\r\n * Saves engine states\r\n */\r\n public saveStates(): void {\r\n this._savedStateDepthTest = this.engine.depthCullingState.depthTest;\r\n this._savedStateStencilTest = this.engine.stencilState.stencilTest;\r\n }\r\n\r\n /**\r\n * Restores engine states\r\n */\r\n public restoreStates(): void {\r\n this.engine.depthCullingState.depthTest = this._savedStateDepthTest;\r\n this.engine.stencilState.stencilTest = this._savedStateStencilTest;\r\n }\r\n\r\n /**\r\n * Draws a full screen quad.\r\n */\r\n public draw(): void {\r\n this.engine.drawElementsType(Constants.MATERIAL_TriangleFillMode, 0, 6);\r\n }\r\n\r\n private _isRenderTargetTexture(texture: RenderTargetWrapper | IRenderTargetTexture): texture is IRenderTargetTexture {\r\n return (texture as IRenderTargetTexture).renderTarget !== undefined;\r\n }\r\n\r\n /**\r\n * renders one or more effects to a specified texture\r\n * @param effectWrapper the effect to renderer\r\n * @param outputTexture texture to draw to, if null it will render to the screen.\r\n */\r\n public render(effectWrapper: EffectWrapper, outputTexture: Nullable<RenderTargetWrapper | IRenderTargetTexture> = null) {\r\n // Ensure effect is ready\r\n if (!effectWrapper.effect.isReady()) {\r\n return;\r\n }\r\n\r\n this.saveStates();\r\n\r\n // Reset state\r\n this.setViewport();\r\n\r\n const out = outputTexture === null ? null : this._isRenderTargetTexture(outputTexture) ? outputTexture.renderTarget! : outputTexture;\r\n\r\n if (out) {\r\n this.engine.bindFramebuffer(out);\r\n }\r\n\r\n this.applyEffectWrapper(effectWrapper);\r\n\r\n this.draw();\r\n\r\n if (out) {\r\n this.engine.unBindFramebuffer(out);\r\n }\r\n\r\n this.restoreStates();\r\n }\r\n\r\n /**\r\n * Disposes of the effect renderer\r\n */\r\n dispose() {\r\n const vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n delete this._vertexBuffers[VertexBuffer.PositionKind];\r\n }\r\n\r\n if (this._indexBuffer) {\r\n this.engine._releaseBuffer(this._indexBuffer);\r\n }\r\n\r\n if (this._onContextRestoredObserver) {\r\n this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Options to create an EffectWrapper\r\n */\r\ninterface EffectWrapperCreationOptions {\r\n /**\r\n * Engine to use to create the effect\r\n */\r\n engine: AbstractEngine;\r\n /**\r\n * Fragment shader for the effect\r\n */\r\n fragmentShader: string;\r\n /**\r\n * Use the shader store instead of direct source code\r\n */\r\n useShaderStore?: boolean;\r\n /**\r\n * Vertex shader for the effect\r\n */\r\n vertexShader?: string;\r\n /**\r\n * Attributes to use in the shader\r\n */\r\n attributeNames?: Array<string>;\r\n /**\r\n * Uniforms to use in the shader\r\n */\r\n uniformNames?: Array<string>;\r\n /**\r\n * Texture sampler names to use in the shader\r\n */\r\n samplerNames?: Array<string>;\r\n /**\r\n * Defines to use in the shader\r\n */\r\n defines?: Array<string>;\r\n /**\r\n * Callback when effect is compiled\r\n */\r\n onCompiled?: Nullable<(effect: Effect) => void>;\r\n /**\r\n * The friendly name of the effect displayed in Spector.\r\n */\r\n name?: string;\r\n /**\r\n * The language the shader is written in (default: GLSL)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n /**\r\n * Additional async code to run before preparing the effect\r\n */\r\n extraInitializationsAsync?: () => Promise<void>;\r\n}\r\n\r\n/**\r\n * Wraps an effect to be used for rendering\r\n */\r\nexport class EffectWrapper {\r\n /**\r\n * Event that is fired right before the effect is drawn (should be used to update uniforms)\r\n */\r\n public onApplyObservable = new Observable<{}>();\r\n /**\r\n * The underlying effect\r\n */\r\n public get effect(): Effect {\r\n return this._drawWrapper.effect!;\r\n }\r\n\r\n public set effect(effect: Effect) {\r\n this._drawWrapper.effect = effect;\r\n }\r\n\r\n /** @internal */\r\n public _drawWrapper: DrawWrapper;\r\n\r\n private _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * Creates an effect to be renderer\r\n * @param creationOptions options to create the effect\r\n */\r\n constructor(creationOptions: EffectWrapperCreationOptions) {\r\n let shaderPath: any;\r\n const uniformNames = creationOptions.uniformNames || [];\r\n\r\n if (creationOptions.vertexShader) {\r\n shaderPath = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertexSource: creationOptions.vertexShader,\r\n spectorName: creationOptions.name || \"effectWrapper\",\r\n };\r\n } else {\r\n // Default scale to use in post process vertex shader.\r\n uniformNames.push(\"scale\");\r\n\r\n shaderPath = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertex: \"postprocess\",\r\n spectorName: creationOptions.name || \"effectWrapper\",\r\n };\r\n\r\n // Sets the default scale to identity for the post process vertex shader.\r\n this.onApplyObservable.add(() => {\r\n this.effect.setFloat2(\"scale\", 1, 1);\r\n });\r\n }\r\n\r\n const defines = creationOptions.defines ? creationOptions.defines.join(\"\\n\") : \"\";\r\n this._drawWrapper = new DrawWrapper(creationOptions.engine);\r\n\r\n if (creationOptions.useShaderStore) {\r\n shaderPath.fragment = shaderPath.fragmentSource;\r\n if (!shaderPath.vertex) {\r\n shaderPath.vertex = shaderPath.vertexSource;\r\n }\r\n\r\n delete shaderPath.fragmentSource;\r\n delete shaderPath.vertexSource;\r\n\r\n this.effect = creationOptions.engine.createEffect(\r\n shaderPath,\r\n creationOptions.attributeNames || [\"position\"],\r\n uniformNames,\r\n creationOptions.samplerNames,\r\n defines,\r\n undefined,\r\n creationOptions.onCompiled,\r\n undefined,\r\n undefined,\r\n creationOptions.shaderLanguage,\r\n creationOptions.extraInitializationsAsync\r\n );\r\n } else {\r\n this.effect = new Effect(\r\n shaderPath,\r\n creationOptions.attributeNames || [\"position\"],\r\n uniformNames,\r\n creationOptions.samplerNames,\r\n creationOptions.engine,\r\n defines,\r\n undefined,\r\n creationOptions.onCompiled,\r\n undefined,\r\n undefined,\r\n undefined,\r\n creationOptions.shaderLanguage,\r\n creationOptions.extraInitializationsAsync\r\n );\r\n\r\n this._onContextRestoredObserver = creationOptions.engine.onContextRestoredObservable.add(() => {\r\n this.effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\r\n this.effect._prepareEffect();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Disposes of the effect wrapper\r\n * @param _ignored kept for backward compatibility\r\n */\r\n public dispose(_ignored: boolean = false) {\r\n if (this._onContextRestoredObserver) {\r\n this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n this.effect.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"effectRenderer.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/effectRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EA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e,CAAC,YAAY,EAC5B,eAAe,CAAC,MAAM,EACtB,OAAO,EACP,SAAS,EACT,eAAe,CAAC,UAAU,EAC1B,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,CAAC,cAAc,EAC9B,eAAe,CAAC,yBAAyB,CAC5C,CAAC;YAEF,IAAI,CAAC,0BAA0B,GAAG,eAAe,CAAC,MAAM,CAAC,2BAA2B,CAAC,GAAG,CAAC,GAAG,EAAE;gBAC1F,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,oHAAoH;gBACzJ,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YACjC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,WAAoB,KAAK;QACpC,IAAI,IAAI,CAAC,0BAA0B,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC5F,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;SAC1C;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Effect } from \"./effect\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { DrawWrapper } from \"./drawWrapper\";\r\nimport type { IRenderTargetTexture, RenderTargetWrapper } from \"../Engines/renderTargetWrapper\";\r\nimport type { ShaderLanguage } from \"./shaderLanguage\";\r\n\r\n// Prevents ES6 issue if not imported.\r\nimport \"../Shaders/postprocess.vertex\";\r\n\r\n/**\r\n * Effect Render Options\r\n */\r\nexport interface IEffectRendererOptions {\r\n /**\r\n * Defines the vertices positions.\r\n */\r\n positions?: number[];\r\n /**\r\n * Defines the indices.\r\n */\r\n indices?: number[];\r\n}\r\n\r\n// Fullscreen quad buffers by default.\r\nconst defaultOptions = {\r\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\r\n indices: [0, 1, 2, 0, 2, 3],\r\n};\r\n\r\n/**\r\n * Helper class to render one or more effects.\r\n * You can access the previous rendering in your shader by declaring a sampler named textureSampler\r\n */\r\nexport class EffectRenderer {\r\n /**\r\n * The engine the effect renderer has been created for.\r\n */\r\n public readonly engine: AbstractEngine;\r\n\r\n private _vertexBuffers: { [key: string]: VertexBuffer };\r\n private _indexBuffer: DataBuffer;\r\n\r\n private _fullscreenViewport = new Viewport(0, 0, 1, 1);\r\n private _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n private _savedStateDepthTest: boolean;\r\n private _savedStateStencilTest: boolean;\r\n\r\n /**\r\n * Creates an effect renderer\r\n * @param engine the engine to use for rendering\r\n * @param options defines the options of the effect renderer\r\n */\r\n constructor(engine: AbstractEngine, options: IEffectRendererOptions = defaultOptions) {\r\n const positions = options.positions ?? defaultOptions.positions;\r\n const indices = options.indices ?? defaultOptions.indices;\r\n\r\n this.engine = engine;\r\n this._vertexBuffers = {\r\n [VertexBuffer.PositionKind]: new VertexBuffer(engine, positions, VertexBuffer.PositionKind, false, false, 2),\r\n };\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n\r\n this._onContextRestoredObserver = engine.onContextRestoredObservable.add(() => {\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n\r\n for (const key in this._vertexBuffers) {\r\n const vertexBuffer = this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Sets the current viewport in normalized coordinates 0-1\r\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\r\n */\r\n public setViewport(viewport = this._fullscreenViewport): void {\r\n this.engine.setViewport(viewport);\r\n }\r\n\r\n /**\r\n * Binds the embedded attributes buffer to the effect.\r\n * @param effect Defines the effect to bind the attributes for\r\n */\r\n public bindBuffers(effect: Effect): void {\r\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n }\r\n\r\n /**\r\n * Sets the current effect wrapper to use during draw.\r\n * The effect needs to be ready before calling this api.\r\n * This also sets the default full screen position attribute.\r\n * @param effectWrapper Defines the effect to draw with\r\n */\r\n public applyEffectWrapper(effectWrapper: EffectWrapper): void {\r\n this.engine.setState(true);\r\n this.engine.depthCullingState.depthTest = false;\r\n this.engine.stencilState.stencilTest = false;\r\n this.engine.enableEffect(effectWrapper._drawWrapper);\r\n this.bindBuffers(effectWrapper.effect);\r\n effectWrapper.onApplyObservable.notifyObservers({});\r\n }\r\n\r\n /**\r\n * Saves engine states\r\n */\r\n public saveStates(): void {\r\n this._savedStateDepthTest = this.engine.depthCullingState.depthTest;\r\n this._savedStateStencilTest = this.engine.stencilState.stencilTest;\r\n }\r\n\r\n /**\r\n * Restores engine states\r\n */\r\n public restoreStates(): void {\r\n this.engine.depthCullingState.depthTest = this._savedStateDepthTest;\r\n this.engine.stencilState.stencilTest = this._savedStateStencilTest;\r\n }\r\n\r\n /**\r\n * Draws a full screen quad.\r\n */\r\n public draw(): void {\r\n this.engine.drawElementsType(Constants.MATERIAL_TriangleFillMode, 0, 6);\r\n }\r\n\r\n private _isRenderTargetTexture(texture: RenderTargetWrapper | IRenderTargetTexture): texture is IRenderTargetTexture {\r\n return (texture as IRenderTargetTexture).renderTarget !== undefined;\r\n }\r\n\r\n /**\r\n * renders one or more effects to a specified texture\r\n * @param effectWrapper the effect to renderer\r\n * @param outputTexture texture to draw to, if null it will render to the screen.\r\n */\r\n public render(effectWrapper: EffectWrapper, outputTexture: Nullable<RenderTargetWrapper | IRenderTargetTexture> = null) {\r\n // Ensure effect is ready\r\n if (!effectWrapper.effect.isReady()) {\r\n return;\r\n }\r\n\r\n this.saveStates();\r\n\r\n // Reset state\r\n this.setViewport();\r\n\r\n const out = outputTexture === null ? null : this._isRenderTargetTexture(outputTexture) ? outputTexture.renderTarget! : outputTexture;\r\n\r\n if (out) {\r\n this.engine.bindFramebuffer(out);\r\n }\r\n\r\n this.applyEffectWrapper(effectWrapper);\r\n\r\n this.draw();\r\n\r\n if (out) {\r\n this.engine.unBindFramebuffer(out);\r\n }\r\n\r\n this.restoreStates();\r\n }\r\n\r\n /**\r\n * Disposes of the effect renderer\r\n */\r\n dispose() {\r\n const vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n delete this._vertexBuffers[VertexBuffer.PositionKind];\r\n }\r\n\r\n if (this._indexBuffer) {\r\n this.engine._releaseBuffer(this._indexBuffer);\r\n }\r\n\r\n if (this._onContextRestoredObserver) {\r\n this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Options to create an EffectWrapper\r\n */\r\ninterface EffectWrapperCreationOptions {\r\n /**\r\n * Engine to use to create the effect\r\n */\r\n engine: AbstractEngine;\r\n /**\r\n * Fragment shader for the effect\r\n */\r\n fragmentShader: string;\r\n /**\r\n * Use the shader store instead of direct source code\r\n */\r\n useShaderStore?: boolean;\r\n /**\r\n * Vertex shader for the effect\r\n */\r\n vertexShader?: string;\r\n /**\r\n * Attributes to use in the shader\r\n */\r\n attributeNames?: Array<string>;\r\n /**\r\n * Uniforms to use in the shader\r\n */\r\n uniformNames?: Array<string>;\r\n /**\r\n * Texture sampler names to use in the shader\r\n */\r\n samplerNames?: Array<string>;\r\n /**\r\n * Defines to use in the shader\r\n */\r\n defines?: Array<string>;\r\n /**\r\n * Callback when effect is compiled\r\n */\r\n onCompiled?: Nullable<(effect: Effect) => void>;\r\n /**\r\n * The friendly name of the effect displayed in Spector.\r\n */\r\n name?: string;\r\n /**\r\n * The language the shader is written in (default: GLSL)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n /**\r\n * Additional async code to run before preparing the effect\r\n */\r\n extraInitializationsAsync?: () => Promise<void>;\r\n}\r\n\r\n/**\r\n * Wraps an effect to be used for rendering\r\n */\r\nexport class EffectWrapper {\r\n /**\r\n * Event that is fired right before the effect is drawn (should be used to update uniforms)\r\n */\r\n public onApplyObservable = new Observable<{}>();\r\n /**\r\n * The underlying effect\r\n */\r\n public get effect(): Effect {\r\n return this._drawWrapper.effect!;\r\n }\r\n\r\n public set effect(effect: Effect) {\r\n this._drawWrapper.effect = effect;\r\n }\r\n\r\n /** @internal */\r\n public _drawWrapper: DrawWrapper;\r\n\r\n private _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * Creates an effect to be renderer\r\n * @param creationOptions options to create the effect\r\n */\r\n constructor(creationOptions: EffectWrapperCreationOptions) {\r\n let shaderPath: any;\r\n const uniformNames = creationOptions.uniformNames || [];\r\n\r\n if (creationOptions.vertexShader) {\r\n shaderPath = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertexSource: creationOptions.vertexShader,\r\n spectorName: creationOptions.name || \"effectWrapper\",\r\n };\r\n } else {\r\n // Default scale to use in post process vertex shader.\r\n uniformNames.push(\"scale\");\r\n\r\n shaderPath = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertex: \"postprocess\",\r\n spectorName: creationOptions.name || \"effectWrapper\",\r\n };\r\n\r\n // Sets the default scale to identity for the post process vertex shader.\r\n this.onApplyObservable.add(() => {\r\n this.effect.setFloat2(\"scale\", 1, 1);\r\n });\r\n }\r\n\r\n const defines = creationOptions.defines ? creationOptions.defines.join(\"\\n\") : \"\";\r\n this._drawWrapper = new DrawWrapper(creationOptions.engine);\r\n\r\n if (creationOptions.useShaderStore) {\r\n shaderPath.fragment = shaderPath.fragmentSource;\r\n if (!shaderPath.vertex) {\r\n shaderPath.vertex = shaderPath.vertexSource;\r\n }\r\n\r\n delete shaderPath.fragmentSource;\r\n delete shaderPath.vertexSource;\r\n\r\n this.effect = creationOptions.engine.createEffect(\r\n shaderPath,\r\n creationOptions.attributeNames || [\"position\"],\r\n uniformNames,\r\n creationOptions.samplerNames,\r\n defines,\r\n undefined,\r\n creationOptions.onCompiled,\r\n undefined,\r\n undefined,\r\n creationOptions.shaderLanguage,\r\n creationOptions.extraInitializationsAsync\r\n );\r\n } else {\r\n this.effect = new Effect(\r\n shaderPath,\r\n creationOptions.attributeNames || [\"position\"],\r\n uniformNames,\r\n creationOptions.samplerNames,\r\n creationOptions.engine,\r\n defines,\r\n undefined,\r\n creationOptions.onCompiled,\r\n undefined,\r\n undefined,\r\n undefined,\r\n creationOptions.shaderLanguage,\r\n creationOptions.extraInitializationsAsync\r\n );\r\n\r\n this._onContextRestoredObserver = creationOptions.engine.onContextRestoredObservable.add(() => {\r\n this.effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\r\n this.effect._prepareEffect();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Disposes of the effect wrapper\r\n * @param _ignored kept for backward compatibility\r\n */\r\n public dispose(_ignored: boolean = false) {\r\n if (this._onContextRestoredObserver) {\r\n this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n this.effect.dispose();\r\n }\r\n}\r\n"]}
@@ -17,7 +17,6 @@ import type { IMaterialContext } from "../Engines/IMaterialContext";
17
17
  import { DrawWrapper } from "./drawWrapper";
18
18
  import { MaterialStencilState } from "./materialStencilState";
19
19
  import type { Scene } from "../scene";
20
- import type { AbstractScene } from "../abstractScene";
21
20
  import type { MaterialPluginDisposed, MaterialPluginIsReadyForSubMesh, MaterialPluginGetDefineNames, MaterialPluginBindForSubMesh, MaterialPluginGetActiveTextures, MaterialPluginHasTexture, MaterialPluginGetAnimatables, MaterialPluginPrepareDefines, MaterialPluginPrepareEffect, MaterialPluginPrepareUniformBuffer, MaterialPluginCreated, MaterialPluginFillRenderTargetTextures, MaterialPluginHasRenderTargetTextures, MaterialPluginHardBindForSubMesh } from "./materialPluginEvent";
22
21
  import type { ShaderCustomProcessingFunction } from "../Engines/Processors/shaderProcessingOptions";
23
22
  import type { IClipPlanesHolder } from "../Misc/interfaces/iClipPlanesHolder";
@@ -25,6 +24,7 @@ import type { PrePassRenderer } from "../Rendering/prePassRenderer";
25
24
  import type { Mesh } from "../Meshes/mesh";
26
25
  import type { Animation } from "../Animations/animation";
27
26
  import { ShaderLanguage } from "./shaderLanguage";
27
+ import type { IAssetContainer } from "../IAssetContainer.js";
28
28
  /**
29
29
  * Options for compiling materials.
30
30
  */
@@ -535,7 +535,7 @@ export declare class Material implements IAnimatable, IClipPlanesHolder {
535
535
  [id: string]: AbstractMesh | undefined;
536
536
  }>;
537
537
  /** @internal */
538
- _parentContainer: Nullable<AbstractScene>;
538
+ _parentContainer: Nullable<IAssetContainer>;
539
539
  /** @internal */
540
540
  _dirtyCallbacks: {
541
541
  [code: number]: () => void;
@@ -47,7 +47,7 @@ export declare class DecalMapConfiguration extends MaterialPluginBase {
47
47
  */
48
48
  constructor(material: PBRBaseMaterial | StandardMaterial, addToPluginList?: boolean);
49
49
  isReadyForSubMesh(defines: DecalMapDefines, scene: Scene, engine: Engine, subMesh: SubMesh): boolean;
50
- prepareDefines(defines: DecalMapDefines, scene: Scene, mesh: AbstractMesh): void;
50
+ prepareDefinesBeforeAttributes(defines: DecalMapDefines, scene: Scene, mesh: AbstractMesh): void;
51
51
  hardBindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, _engine: Engine, subMesh: SubMesh): void;
52
52
  getClassName(): string;
53
53
  getSamplers(samplers: string[]): void;
@@ -63,7 +63,7 @@ export class DecalMapConfiguration extends MaterialPluginBase {
63
63
  }
64
64
  return decalMap.isReady();
65
65
  }
66
- prepareDefines(defines, scene, mesh) {
66
+ prepareDefinesBeforeAttributes(defines, scene, mesh) {
67
67
  const decalMap = mesh.decalMap;
68
68
  if (!this._isEnabled || !decalMap?.texture || !MaterialFlags.DecalMapEnabled || !scene.texturesEnabled) {
69
69
  const isDirty = defines.DECAL;