@onerjs/core 8.51.4 → 8.51.5

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 (173) hide show
  1. package/Animations/animatorAvatar.d.ts +2 -0
  2. package/Animations/animatorAvatar.js +163 -94
  3. package/Animations/animatorAvatar.js.map +1 -1
  4. package/Engines/constants.d.ts +10 -0
  5. package/Engines/constants.js +10 -0
  6. package/Engines/constants.js.map +1 -1
  7. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +6 -3
  8. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  9. package/Materials/PBR/openpbrMaterial.d.ts +8 -0
  10. package/Materials/PBR/openpbrMaterial.js +16 -0
  11. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  12. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
  13. package/Materials/PBR/pbrBaseMaterial.js +8 -0
  14. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  15. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +6 -0
  16. package/Materials/Textures/Procedurals/proceduralTexture.js +3 -1
  17. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  18. package/Materials/Textures/index.d.ts +1 -0
  19. package/Materials/Textures/index.js +1 -0
  20. package/Materials/Textures/index.js.map +1 -1
  21. package/Materials/Textures/textureMerger.js +1 -0
  22. package/Materials/Textures/textureMerger.js.map +1 -1
  23. package/Materials/Textures/textureProcessor.d.ts +315 -0
  24. package/Materials/Textures/textureProcessor.js +792 -0
  25. package/Materials/Textures/textureProcessor.js.map +1 -0
  26. package/Materials/material.d.ts +24 -0
  27. package/Materials/material.js +39 -0
  28. package/Materials/material.js.map +1 -1
  29. package/Materials/standardMaterial.d.ts +1 -0
  30. package/Materials/standardMaterial.js +6 -0
  31. package/Materials/standardMaterial.js.map +1 -1
  32. package/Physics/v2/characterController.d.ts +104 -7
  33. package/Physics/v2/characterController.js +355 -7
  34. package/Physics/v2/characterController.js.map +1 -1
  35. package/Shaders/ShadersInclude/bumpFragment.js +3 -3
  36. package/Shaders/ShadersInclude/bumpFragment.js.map +1 -1
  37. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +5 -1
  38. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  39. package/Shaders/ShadersInclude/defaultFragmentDeclaration.js +3 -0
  40. package/Shaders/ShadersInclude/defaultFragmentDeclaration.js.map +1 -1
  41. package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
  42. package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  43. package/Shaders/ShadersInclude/defaultVertexDeclaration.js +1 -1
  44. package/Shaders/ShadersInclude/defaultVertexDeclaration.js.map +1 -1
  45. package/Shaders/ShadersInclude/openpbrAmbientOcclusionData.js +1 -1
  46. package/Shaders/ShadersInclude/openpbrAmbientOcclusionData.js.map +1 -1
  47. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  48. package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  49. package/Shaders/ShadersInclude/openpbrBaseLayerData.js +14 -14
  50. package/Shaders/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
  51. package/Shaders/ShadersInclude/openpbrCoatLayerData.js +6 -6
  52. package/Shaders/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
  53. package/Shaders/ShadersInclude/openpbrDirectLighting.js +1 -1
  54. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  55. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  56. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  57. package/Shaders/ShadersInclude/openpbrFragmentDeclaration.js +3 -0
  58. package/Shaders/ShadersInclude/openpbrFragmentDeclaration.js.map +1 -1
  59. package/Shaders/ShadersInclude/openpbrFuzzLayerData.js +3 -3
  60. package/Shaders/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
  61. package/Shaders/ShadersInclude/openpbrNormalMapFragment.js +4 -4
  62. package/Shaders/ShadersInclude/openpbrNormalMapFragment.js.map +1 -1
  63. package/Shaders/ShadersInclude/openpbrSubsurfaceLayerData.js +7 -3
  64. package/Shaders/ShadersInclude/openpbrSubsurfaceLayerData.js.map +1 -1
  65. package/Shaders/ShadersInclude/openpbrThinFilmLayerData.js +2 -2
  66. package/Shaders/ShadersInclude/openpbrThinFilmLayerData.js.map +1 -1
  67. package/Shaders/ShadersInclude/openpbrTransmissionLayerData.js +5 -5
  68. package/Shaders/ShadersInclude/openpbrTransmissionLayerData.js.map +1 -1
  69. package/Shaders/ShadersInclude/openpbrUboDeclaration.js +1 -1
  70. package/Shaders/ShadersInclude/openpbrUboDeclaration.js.map +1 -1
  71. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +1 -1
  72. package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
  73. package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js +1 -1
  74. package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
  75. package/Shaders/ShadersInclude/pbrBlockLightmapInit.js +1 -1
  76. package/Shaders/ShadersInclude/pbrBlockLightmapInit.js.map +1 -1
  77. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +3 -0
  78. package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
  79. package/Shaders/ShadersInclude/pbrHelperFunctions.js +4 -0
  80. package/Shaders/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  81. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  82. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  83. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +1 -1
  84. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  85. package/Shaders/ShadersInclude/textureRepetitionFunctions.d.ts +5 -0
  86. package/Shaders/ShadersInclude/textureRepetitionFunctions.js +52 -0
  87. package/Shaders/ShadersInclude/textureRepetitionFunctions.js.map +1 -0
  88. package/Shaders/default.fragment.d.ts +1 -0
  89. package/Shaders/default.fragment.js +8 -6
  90. package/Shaders/default.fragment.js.map +1 -1
  91. package/Shaders/geometry.fragment.js +3 -3
  92. package/Shaders/geometry.fragment.js.map +1 -1
  93. package/Shaders/openpbr.fragment.d.ts +1 -0
  94. package/Shaders/openpbr.fragment.js +4 -2
  95. package/Shaders/openpbr.fragment.js.map +1 -1
  96. package/Shaders/pbr.fragment.d.ts +1 -0
  97. package/Shaders/pbr.fragment.js +24 -22
  98. package/Shaders/pbr.fragment.js.map +1 -1
  99. package/Shaders/textureProcessor.fragment.d.ts +5 -0
  100. package/Shaders/textureProcessor.fragment.js +156 -0
  101. package/Shaders/textureProcessor.fragment.js.map +1 -0
  102. package/ShadersWGSL/ShadersInclude/bumpFragment.js +3 -3
  103. package/ShadersWGSL/ShadersInclude/bumpFragment.js.map +1 -1
  104. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +5 -1
  105. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  106. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
  107. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  108. package/ShadersWGSL/ShadersInclude/openpbrAmbientOcclusionData.js +1 -1
  109. package/ShadersWGSL/ShadersInclude/openpbrAmbientOcclusionData.js.map +1 -1
  110. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
  111. package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
  112. package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +15 -15
  113. package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
  114. package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js +7 -7
  115. package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
  116. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +1 -1
  117. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  118. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  119. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  120. package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js +4 -4
  121. package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
  122. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +3 -3
  123. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  124. package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragment.js +4 -4
  125. package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragment.js.map +1 -1
  126. package/ShadersWGSL/ShadersInclude/openpbrSubsurfaceLayerData.js +7 -3
  127. package/ShadersWGSL/ShadersInclude/openpbrSubsurfaceLayerData.js.map +1 -1
  128. package/ShadersWGSL/ShadersInclude/openpbrThinFilmLayerData.js +2 -2
  129. package/ShadersWGSL/ShadersInclude/openpbrThinFilmLayerData.js.map +1 -1
  130. package/ShadersWGSL/ShadersInclude/openpbrTransmissionLayerData.js +6 -6
  131. package/ShadersWGSL/ShadersInclude/openpbrTransmissionLayerData.js.map +1 -1
  132. package/ShadersWGSL/ShadersInclude/openpbrUboDeclaration.js +1 -1
  133. package/ShadersWGSL/ShadersInclude/openpbrUboDeclaration.js.map +1 -1
  134. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +1 -1
  135. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
  136. package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.js +1 -1
  137. package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.js.map +1 -1
  138. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +4 -0
  139. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  140. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  141. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  142. package/ShadersWGSL/ShadersInclude/textureRepetitionFunctions.d.ts +5 -0
  143. package/ShadersWGSL/ShadersInclude/textureRepetitionFunctions.js +52 -0
  144. package/ShadersWGSL/ShadersInclude/textureRepetitionFunctions.js.map +1 -0
  145. package/ShadersWGSL/default.fragment.d.ts +1 -0
  146. package/ShadersWGSL/default.fragment.js +8 -6
  147. package/ShadersWGSL/default.fragment.js.map +1 -1
  148. package/ShadersWGSL/geometry.fragment.js +3 -3
  149. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  150. package/ShadersWGSL/openpbr.fragment.d.ts +1 -0
  151. package/ShadersWGSL/openpbr.fragment.js +5 -3
  152. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  153. package/ShadersWGSL/openpbr.vertex.js +1 -1
  154. package/ShadersWGSL/openpbr.vertex.js.map +1 -1
  155. package/ShadersWGSL/pbr.fragment.d.ts +1 -0
  156. package/ShadersWGSL/pbr.fragment.js +24 -22
  157. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  158. package/ShadersWGSL/textureProcessor.fragment.d.ts +5 -0
  159. package/ShadersWGSL/textureProcessor.fragment.js +161 -0
  160. package/ShadersWGSL/textureProcessor.fragment.js.map +1 -0
  161. package/SmartAssets/index.d.ts +2 -0
  162. package/SmartAssets/index.js +2 -0
  163. package/SmartAssets/index.js.map +1 -0
  164. package/SmartAssets/smartAssetManager.d.ts +156 -0
  165. package/SmartAssets/smartAssetManager.js +531 -0
  166. package/SmartAssets/smartAssetManager.js.map +1 -0
  167. package/SmartAssets/smartAssetSerializer.d.ts +61 -0
  168. package/SmartAssets/smartAssetSerializer.js +97 -0
  169. package/SmartAssets/smartAssetSerializer.js.map +1 -0
  170. package/index.d.ts +1 -0
  171. package/index.js +1 -0
  172. package/index.js.map +1 -1
  173. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureProcessor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/textureProcessor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAMpE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IACzB,gFAAgF;IAChF,6DAAU,CAAA;IACV,qGAAqG;IACrG,yDAAQ,CAAA;AACZ,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACnB,gDAAgD;IAChD,uCAAO,CAAA;IACP,kDAAkD;IAClD,uCAAO,CAAA;IACP,iDAAiD;IACjD,uCAAO,CAAA;IACP,kDAAkD;IAClD,uCAAO,CAAA;IACP,yDAAyD;IACzD,2CAAS,CAAA;IACT,+DAA+D;IAC/D,8CAAU,CAAA;AACd,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAN,IAAY,cAWX;AAXD,WAAY,cAAc;IACtB,kDAAkD;IAClD,mDAAQ,CAAA;IACR,8DAA8D;IAC9D,6CAAK,CAAA;IACL,gEAAgE;IAChE,6CAAK,CAAA;IACL,+DAA+D;IAC/D,6CAAK,CAAA;IACL,gEAAgE;IAChE,6CAAK,CAAA;AACT,CAAC,EAXW,cAAc,KAAd,cAAc,QAWzB;AA0DD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA8B,EAAE,OAAwB,EAAE,UAA8B;IACzH,MAAM,EAAE,GAA2B,EAAE,OAAO,EAAE,CAAC;IAC/C,IAAI,OAAO,EAAE,CAAC;QACV,EAAE,CAAC,OAAO,G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ptions } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\nimport { ProceduralTexture } from \"./Procedurals/proceduralTexture\";\nimport { type BaseTexture } from \"./baseTexture\";\nimport { type Nullable } from \"../../types\";\nimport { type Texture } from \"./texture\";\nimport { type TextureSize } from \"./textureCreationOptions\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { Constants } from \"../../Engines/constants\";\nimport { Color4 } from \"core/Maths/math.color\";\n\nconst _ShaderName = \"textureProcessor\";\n\n/**\n * Specifies the color space of a texture operand.\n * When `sRGB` is set the sampled RGB values are converted to linear space before any channel\n * swizzle, factor multiplication, or arithmetic operation. Alpha is always treated as linear.\n */\nexport enum TextureColorSpace {\n /** Texture data is already in linear space (default). No conversion applied. */\n Linear = 0,\n /** Texture data is in sRGB (gamma) space. RGB channels are linearized (IEC 61966-2-1) before use. */\n SRGB = 1,\n}\n\n/**\n * Bitmask controlling which channels are written to the output texture by a processing operation.\n * Channels excluded from the mask receive a sensible default: `0.0` for RGB channels, `1.0` for alpha.\n * Use `ChannelMask.RGBA` (or omit the parameter) to pass all channels through unchanged.\n *\n * | Flag | Channels written | Excluded channels |\n * |------|-----------------|-------------------|\n * | R | red | G=0, B=0, A=1 |\n * | G | green | R=0, B=0, A=1 |\n * | B | blue | R=0, G=0, A=1 |\n * | A | alpha | R=0, G=0, B=0 |\n * | RGB | red, green, blue | A=1 |\n * | RGBA | all four | (none) |\n */\nexport enum ChannelMask {\n /** Pass only the red channel; G=0, B=0, A=1. */\n R = 0x1,\n /** Pass only the green channel; R=0, B=0, A=1. */\n G = 0x2,\n /** Pass only the blue channel; R=0, G=0, A=1. */\n B = 0x4,\n /** Pass only the alpha channel; R=0, G=0, B=0. */\n A = 0x8,\n /** Pass red, green, and blue; alpha is forced to 1.0. */\n RGB = 0x7,\n /** Pass all four channels unchanged (default — no masking). */\n RGBA = 0xf,\n}\n\n/**\n * Specifies which channel of a texture to read for an operation.\n * When a single channel is selected its scalar value is broadcast to RGB; alpha\n * is either preserved from the original sample or replicated when `A` is chosen.\n *\n * | Value | Swizzle |\n * |-------|---------|\n * | RGBA | (r, g, b, a) — no swizzle (default) |\n * | R | (r, r, r, a) |\n * | G | (g, g, g, a) |\n * | B | (b, b, b, a) |\n * | A | (a, a, a, a) |\n */\nexport enum TextureChannel {\n /** Use all four channels as sampled (default). */\n RGBA = 0,\n /** Broadcast the red channel to RGB; preserve alpha: RRRA. */\n R = 1,\n /** Broadcast the green channel to RGB; preserve alpha: GGGA. */\n G = 2,\n /** Broadcast the blue channel to RGB; preserve alpha: BBBA. */\n B = 3,\n /** Broadcast the alpha channel to all four components: AAAA. */\n A = 4,\n}\n\n/**\n * Represents an operand for a texture processing operation, or the result of one.\n *\n * As an operand, the value evaluates to a vec4 per texel:\n * - `texture` only → `sample(texture)`\n * - `factor` only → `factor` (constant)\n * - both → `sample(texture) * factor`\n *\n * As a result returned by a processing function:\n * - `texture` holds the GPU-processed output; `dispose()` releases it when no longer needed.\n * - `factor` holds a CPU-folded constant when all inputs were texture-free; no `dispose` is set.\n *\n * Results are directly usable as operands to subsequent operations. When a result with a\n * `dispose` function is passed as an operand, the next operation automatically calls `dispose`\n * after consuming it, so intermediate textures are cleaned up without manual tracking.\n *\n * At least one of `texture` or `factor` must be provided when used as an operand.\n */\nexport interface ITextureProcessOperand {\n /**\n * Texture to sample. When combined with `factor`, the sampled value is multiplied\n * component-wise by the factor. Null when the operand or result is a constant.\n */\n texture: Nullable<BaseTexture>;\n /**\n * Optional constant RGBA factor. If `texture` is also set, the sampled value is\n * multiplied by this factor. If `texture` is not set, this becomes the constant output.\n * When omitted and `texture` is set, defaults to (1, 1, 1, 1) — no scaling.\n */\n factor?: Color4;\n /**\n * Optional channel selection applied to the sampled texture value before any factor\n * multiplication. When omitted or set to `TextureChannel.RGBA`, the sample is used\n * as-is. When set to a single channel, that channel's scalar is broadcast to RGB\n * (or all four components for `TextureChannel.A`). Only meaningful when `texture` is set.\n */\n channel?: TextureChannel;\n\n /**\n * Color space of the texture data. When set to `TextureColorSpace.SRGB`, the sampled\n * RGB channels are converted from sRGB to linear space (IEC 61966-2-1) before the channel\n * swizzle, factor multiplication, and any arithmetic operation. Alpha is always linear.\n * Defaults to `TextureColorSpace.Linear` (no conversion). Only meaningful when `texture` is set.\n */\n colorSpace?: TextureColorSpace;\n\n /**\n * Disposes the texture produced by a processing operation. Only present on results\n * returned by the texture processing functions. When a result is passed as an operand\n * to the next operation in a chain, its `dispose` is called automatically after the\n * GPU pass completes. Call `dispose` explicitly on the final result when the texture\n * is no longer needed (or skip it if transferring ownership to a material).\n */\n dispose?: () => void;\n}\n\n/**\n * Create an operand from a texture alone (no constant factor scaling).\n * @param texture - The texture to sample, or null to produce an identity (1,1,1,1) constant operand\n * @param channel - Optional channel selection. When set, the sampled value is swizzled before use\n * (e.g. `TextureChannel.R` → RRRA). Defaults to `TextureChannel.RGBA` (no swizzle).\n * @param colorSpace - Optional color space. When `TextureColorSpace.SRGB`, the sampled RGB channels\n * are linearized before use. Defaults to `TextureColorSpace.Linear`.\n * @returns An operand that evaluates to the sampled texture value\n */\nexport function CreateTextureOperand(texture: Nullable<BaseTexture>, channel?: TextureChannel, colorSpace?: TextureColorSpace): ITextureProcessOperand {\n const op: ITextureProcessOperand = { texture };\n if (channel) {\n op.channel = channel;\n }\n if (colorSpace) {\n op.colorSpace = colorSpace;\n }\n return op;\n}\n\n/**\n * Create an operand from a constant RGBA factor with no texture.\n * @param factor - The constant RGBA value\n * @returns An operand that evaluates to the constant factor\n */\nexport function CreateFactorOperand(factor: Color4): ITextureProcessOperand {\n return { texture: null, factor };\n}\n\n/**\n * Create an operand from a texture multiplied by a constant RGBA factor.\n * This is the standard glTF pattern (e.g. baseColorTexture * baseColorFactor).\n * If `texture` is null, returns a factor-only operand.\n * @param texture - The texture to sample, or null to use the factor alone\n * @param factor - The constant factor to multiply by\n * @param channel - Optional channel selection. When set, the sampled value is swizzled before\n * factor multiplication (e.g. `TextureChannel.G` → GGGA, then multiplied by factor).\n * Defaults to `TextureChannel.RGBA` (no swizzle).\n * @param colorSpace - Optional color space. When `TextureColorSpace.SRGB`, the sampled RGB channels\n * are linearized before factor multiplication. Defaults to `TextureColorSpace.Linear`.\n * @returns An operand that evaluates to `sample(texture) * factor`, or `factor` if texture is null\n */\nexport function CreateTextureWithFactorOperand(texture: Nullable<BaseTexture>, factor: Color4, channel?: TextureChannel, colorSpace?: TextureColorSpace): ITextureProcessOperand {\n const op: ITextureProcessOperand = { texture, factor };\n if (channel) {\n op.channel = channel;\n }\n if (colorSpace) {\n op.colorSpace = colorSpace;\n }\n return op;\n}\n\n/**\n * @internal\n * Evaluate the effective constant Color4 of an operand.\n * When a texture-only operand omits factor, the implicit value is (1, 1, 1, 1).\n */\nfunction _EvalConstant(op: ITextureProcessOperand): Color4 {\n return op.factor ?? new Color4(1, 1, 1, 1);\n}\n\n/** @internal */\nfunction _MultiplyConstants(a: Color4, b: Color4): Color4 {\n return new Color4(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a);\n}\n\n/** @internal */\nfunction _MaxConstants(a: Color4, b: Color4): Color4 {\n return new Color4(Math.max(a.r, b.r), Math.max(a.g, b.g), Math.max(a.b, b.b), Math.max(a.a, b.a));\n}\n\n/** @internal */\nfunction _LerpConstants(a: Color4, b: Color4, t: Color4): Color4 {\n return new Color4(a.r + (b.r - a.r) * t.r, a.g + (b.g - a.g) * t.g, a.b + (b.b - a.b) * t.b, a.a + (b.a - a.a) * t.a);\n}\n\n/**\n * @internal\n * Determine the output texture size from a list of operands, using the largest input texture.\n */\nfunction _ResolveOutputSize(operands: ITextureProcessOperand[]): TextureSize {\n let maxDim = 0;\n let result: TextureSize = 512;\n for (const op of operands) {\n if (op.texture) {\n const size = op.texture.getSize();\n const dim = Math.max(size.width, size.height);\n if (dim > maxDim) {\n maxDim = dim;\n result = size.width === size.height ? dim : size;\n }\n }\n }\n return result;\n}\n\n/**\n * @internal\n * Returns true when the texture has a non-identity UV transform (offset, scale, or rotation).\n */\nfunction _HasNonIdentityTransform(texture: BaseTexture): boolean {\n return !texture.getTextureMatrix().isIdentity();\n}\n\n/**\n * @internal\n * Returns true when every texture in the list shares the same UV transform matrix.\n * A single texture (or empty list) trivially satisfies this.\n */\nfunction _AllTransformsMatch(textures: BaseTexture[]): boolean {\n if (textures.length <= 1) {\n return true;\n }\n const ref = textures[0].getTextureMatrix();\n for (let i = 1; i < textures.length; i++) {\n if (!ref.equals(textures[i].getTextureMatrix())) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * @internal\n * Copy sampling metadata from a source texture onto the output ProceduralTexture.\n * `coordinatesIndex` and wrap modes are always copied.\n * When `includeTransform` is true the UV offset/scale/rotation are also copied\n * (used when all inputs share the same transform and it is propagated rather than baked).\n */\nfunction _CopyTextureMetadata(from: BaseTexture, to: ProceduralTexture, includeTransform: boolean): void {\n to.coordinatesIndex = from.coordinatesIndex;\n to.wrapU = from.wrapU;\n to.wrapV = from.wrapV;\n if (includeTransform) {\n const src = from as Texture;\n to.uOffset = src.uOffset ?? 0;\n to.vOffset = src.vOffset ?? 0;\n to.uScale = src.uScale ?? 1;\n to.vScale = src.vScale ?? 1;\n to.wAng = src.wAng ?? 0;\n }\n}\n\n/**\n * @internal\n * Return the shader define suffix for a TextureChannel (e.g. TextureChannel.R → \"R\").\n * Returns an empty string for RGBA (no swizzle needed).\n */\nfunction _ChannelDefine(channel: TextureChannel): string {\n switch (channel) {\n case TextureChannel.R:\n return \"R\";\n case TextureChannel.G:\n return \"G\";\n case TextureChannel.B:\n return \"B\";\n case TextureChannel.A:\n return \"A\";\n default:\n return \"\";\n }\n}\n\n/**\n * @internal\n * Apply a channel swizzle to a constant Color4, matching the GPU behaviour for TextureChannel.\n */\nfunction _ApplyChannelSwizzle(c: Color4, channel: TextureChannel): Color4 {\n switch (channel) {\n case TextureChannel.R:\n return new Color4(c.r, c.r, c.r, c.a);\n case TextureChannel.G:\n return new Color4(c.g, c.g, c.g, c.a);\n case TextureChannel.B:\n return new Color4(c.b, c.b, c.b, c.a);\n case TextureChannel.A:\n return new Color4(c.a, c.a, c.a, c.a);\n default:\n return c;\n }\n}\n\n/**\n * @internal\n * Build the OP_INVERT define plus per-channel INVERT_R/G/B/A defines from an ChannelMask bitmask.\n */\nfunction _BuildInvertDefines(channels: ChannelMask): string[] {\n const defines: string[] = [\"OP_INVERT\"];\n if (channels & ChannelMask.R) {\n defines.push(\"INVERT_R\");\n }\n if (channels & ChannelMask.G) {\n defines.push(\"INVERT_G\");\n }\n if (channels & ChannelMask.B) {\n defines.push(\"INVERT_B\");\n }\n if (channels & ChannelMask.A) {\n defines.push(\"INVERT_A\");\n }\n return defines;\n}\n\n/**\n * @internal\n * Build OUTPUT_MASK_X_ZERO / OUTPUT_MASK_A_ONE defines for excluded channels.\n * Channels present in the mask pass through; excluded channels get defaults (0.0 for RGB, 1.0 for A).\n * Returns an empty array for ChannelMask.RGBA (no masking needed).\n */\nfunction _BuildOutputChannelMaskDefines(mask: ChannelMask): string[] {\n const defines: string[] = [];\n if (!(mask & ChannelMask.R)) {\n defines.push(\"OUTPUT_MASK_R_ZERO\");\n }\n if (!(mask & ChannelMask.G)) {\n defines.push(\"OUTPUT_MASK_G_ZERO\");\n }\n if (!(mask & ChannelMask.B)) {\n defines.push(\"OUTPUT_MASK_B_ZERO\");\n }\n if (!(mask & ChannelMask.A)) {\n defines.push(\"OUTPUT_MASK_A_ONE\");\n }\n return defines;\n}\n\n/**\n * @internal\n * Apply a ChannelMask to a constant Color4: included channels pass through,\n * excluded color channels become 0, excluded alpha becomes 1.\n */\nfunction _ApplyOutputChannelMask(c: Color4, mask: ChannelMask): Color4 {\n return new Color4(mask & ChannelMask.R ? c.r : 0, mask & ChannelMask.G ? c.g : 0, mask & ChannelMask.B ? c.b : 0, mask & ChannelMask.A ? c.a : 1);\n}\n\n/**\n * @internal\n * Build shader defines for a standard A/B operand.\n * When `bakeTransform` is true and the texture has a non-identity UV transform,\n * the OPERAND_X_MATRIX define is emitted so the shader applies the matrix when sampling.\n */\nfunction _BuildOperandDefines(operand: ITextureProcessOperand, prefix: \"A\" | \"B\", bakeTransform: boolean): string[] {\n const defines: string[] = [];\n if (operand.texture) {\n defines.push(`OPERAND_${prefix}_TEXTURE`);\n if (bakeTransform && _HasNonIdentityTransform(operand.texture)) {\n defines.push(`OPERAND_${prefix}_MATRIX`);\n }\n if (operand.colorSpace) {\n defines.push(`OPERAND_${prefix}_SRGB`);\n }\n if (operand.channel) {\n defines.push(`OPERAND_${prefix}_CHANNEL_${_ChannelDefine(operand.channel)}`);\n }\n }\n if (operand.factor !== undefined || !operand.texture) {\n defines.push(`OPERAND_${prefix}_FACTOR`);\n }\n return defines;\n}\n\n/**\n * @internal\n * Build shader defines for the lerp blend operand.\n * When `bakeTransform` is true and the texture has a non-identity UV transform,\n * the LERP_T_MATRIX define is emitted.\n */\nfunction _BuildLerpBlendDefines(t: ITextureProcessOperand, bakeTransform: boolean): string[] {\n const defines: string[] = [];\n if (t.texture) {\n defines.push(\"LERP_T_TEXTURE\");\n if (bakeTransform && _HasNonIdentityTransform(t.texture)) {\n defines.push(\"LERP_T_MATRIX\");\n }\n if (t.factor !== undefined) {\n defines.push(\"LERP_T_FACTOR\");\n }\n if (t.colorSpace) {\n defines.push(\"LERP_T_SRGB\");\n }\n if (t.channel) {\n defines.push(`LERP_T_CHANNEL_${_ChannelDefine(t.channel)}`);\n }\n }\n // factor-only: no additional defines needed; the shader uses factorT when LERP_T_TEXTURE is absent.\n return defines;\n}\n\n/**\n * @internal\n * Set uniforms and textures for a standard A/B operand on a procedural texture.\n * When `bakeTransform` is true and the texture has a non-identity UV matrix,\n * that matrix is uploaded as `<textureName>Matrix` for the shader to apply when sampling.\n */\nfunction _SetOperandUniforms(pt: ProceduralTexture, operand: ITextureProcessOperand, textureName: string, factorName: string, bakeTransform: boolean): void {\n if (operand.texture) {\n pt.setTexture(textureName, operand.texture as Texture);\n if (bakeTransform && _HasNonIdentityTransform(operand.texture)) {\n pt.setMatrix(`${textureName}Matrix`, operand.texture.getTextureMatrix());\n }\n }\n const needsFactor = operand.factor !== undefined || !operand.texture;\n if (needsFactor) {\n pt.setColor4(factorName, _EvalConstant(operand));\n }\n}\n\n/**\n * @internal\n * Set uniforms and textures for the lerp blend operand.\n * When `bakeTransform` is true and the texture has a non-identity UV matrix,\n * that matrix is uploaded as `textureTMatrix`.\n */\nfunction _SetLerpBlendUniforms(pt: ProceduralTexture, t: ITextureProcessOperand, bakeTransform: boolean): void {\n if (t.texture) {\n pt.setTexture(\"textureT\", t.texture as Texture);\n if (bakeTransform && _HasNonIdentityTransform(t.texture)) {\n pt.setMatrix(\"textureTMatrix\", t.texture.getTextureMatrix());\n }\n if (t.factor !== undefined) {\n pt.setColor4(\"factorT\", t.factor);\n }\n } else {\n pt.setColor4(\"factorT\", _EvalConstant(t));\n }\n}\n\n/**\n * @internal\n * Create a textureProcessor procedural texture with the given defines. The returned texture\n * is not yet rendered — uniforms must be set on it before calling _RenderAsync.\n */\nfunction _CreateProcessorTexture(\n name: string,\n defines: string[],\n outputSize: TextureSize,\n scene: Scene,\n outputColorSpace: TextureColorSpace = TextureColorSpace.Linear\n): ProceduralTexture {\n const options: IProceduralTextureCreationOptions = {\n type: Constants.TEXTURETYPE_UNSIGNED_BYTE,\n format: Constants.TEXTUREFORMAT_RGBA,\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\n generateDepthBuffer: false,\n generateMipMaps: false,\n gammaSpace: outputColorSpace === TextureColorSpace.SRGB,\n shaderLanguage: scene.getEngine().isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (scene.getEngine().isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/textureProcessor.fragment\")]);\n } else {\n await Promise.all([import(\"../../Shaders/textureProcessor.fragment\")]);\n }\n },\n // Opt out of scene-managed rendering. _shouldRender() would re-render the texture\n // on the first scene frame regardless of refreshRate (because _currentRefreshId starts\n // at -1 and is only advanced by _shouldRender() itself, not by a direct render() call).\n // That re-render would sample already-disposed input textures, producing blank output.\n skipSceneRegistration: true,\n };\n\n const pt = new ProceduralTexture(name, outputSize, _ShaderName, scene, options);\n pt.refreshRate = -1; // render on demand only\n pt.defines = defines.length > 0 ? \"#define \" + defines.join(\"\\n#define \") + \"\\n\" : \"\";\n return pt;\n}\n\n/**\n * @internal\n * Wait for a procedural texture's shader to compile then render it. Uniforms must be set\n * on the texture before calling this.\n */\nasync function _RenderAsync(pt: ProceduralTexture): Promise<void> {\n return await new Promise<void>((resolve, reject) => {\n pt.executeWhenReady(() => {\n try {\n pt.render();\n resolve();\n } catch (error) {\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n });\n}\n\n/**\n * Multiply two texture operands together, component-wise: `result = a * b`.\n *\n * Each operand can be a texture, a constant factor, or a texture scaled by a factor.\n * This is useful for applying glTF-style factors to textures (e.g. `baseColorTexture * baseColorFactor`),\n * or for modulating one texture by another.\n *\n * If both operands are constant (no textures), the multiplication is performed on the CPU and\n * the result is returned as a factor-only operand with no texture allocated.\n *\n * When operands are results of previous operations (i.e. they carry a `dispose` function),\n * their intermediate textures are automatically released after the GPU pass completes.\n *\n * @param name - Name for the resulting procedural texture (used only when a GPU pass is needed)\n * @param a - First operand\n * @param b - Second operand\n * @param scene - Scene to create the texture in (used only when a GPU pass is needed)\n * @param outputColorSpace - Optional output color space. When `TextureColorSpace.SRGB`, the linear\n * result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to `TextureColorSpace.Linear`.\n * @param outputChannelMask - Optional bitmask of channels to write. Excluded color channels are set to\n * `0.0`; excluded alpha is set to `1.0`. Defaults to `ChannelMask.RGBA` (all channels written).\n * @returns An operand whose `texture` holds the GPU result, or whose `factor` holds the CPU-folded constant\n */\nexport async function MultiplyTexturesAsync(\n name: string,\n a: ITextureProcessOperand,\n b: ITextureProcessOperand,\n scene: Scene,\n outputColorSpace?: TextureColorSpace,\n outputChannelMask?: ChannelMask\n): Promise<ITextureProcessOperand> {\n if (!a.texture && !b.texture) {\n const factor = _MultiplyConstants(_EvalConstant(a), _EvalConstant(b));\n return { texture: null, factor: outputChannelMask ? _ApplyOutputChannelMask(factor, outputChannelMask) : factor };\n }\n\n const allTextures: BaseTexture[] = [];\n if (a.texture) {\n allTextures.push(a.texture);\n }\n if (b.texture) {\n allTextures.push(b.texture);\n }\n const canPropagate = _AllTransformsMatch(allTextures);\n const bakeTransform = !canPropagate;\n\n const defines = [\n ..._BuildOperandDefines(a, \"A\", bakeTransform),\n ..._BuildOperandDefines(b, \"B\", bakeTransform),\n ...(outputChannelMask ? _BuildOutputChannelMaskDefines(outputChannelMask) : []),\n ];\n if (outputColorSpace) {\n defines.push(\"OUTPUT_SRGB\");\n }\n const pt = _CreateProcessorTexture(name, defines, _ResolveOutputSize([a, b]), scene, outputColorSpace);\n _SetOperandUniforms(pt, a, \"textureA\", \"factorA\", bakeTransform);\n _SetOperandUniforms(pt, b, \"textureB\", \"factorB\", bakeTransform);\n try {\n await _RenderAsync(pt);\n } catch (error) {\n a.dispose?.();\n b.dispose?.();\n throw error;\n }\n\n a.dispose?.();\n b.dispose?.();\n\n _CopyTextureMetadata(allTextures[0], pt, canPropagate);\n const result: ITextureProcessOperand = { texture: pt, dispose: () => pt.dispose() };\n if (outputColorSpace) {\n result.colorSpace = outputColorSpace;\n }\n return result;\n}\n\n/**\n * Take the component-wise maximum of two texture operands: `result = max(a, b)`.\n *\n * Each operand can be a texture, a constant factor, or a texture scaled by a factor.\n * Useful for operations such as combining ambient occlusion maps or taking the\n * brightest contribution from two sources.\n *\n * If both operands are constant (no textures), the operation is performed on the CPU and\n * the result is returned as a factor-only operand with no texture allocated.\n *\n * When operands are results of previous operations (i.e. they carry a `dispose` function),\n * their intermediate textures are automatically released after the GPU pass completes.\n *\n * @param name - Name for the resulting procedural texture (used only when a GPU pass is needed)\n * @param a - First operand\n * @param b - Second operand\n * @param scene - Scene to create the texture in (used only when a GPU pass is needed)\n * @param outputColorSpace - Optional output color space. When `TextureColorSpace.SRGB`, the linear\n * result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to `TextureColorSpace.Linear`.\n * @param outputChannelMask - Optional bitmask of channels to write. Excluded color channels are set to\n * `0.0`; excluded alpha is set to `1.0`. Defaults to `ChannelMask.RGBA` (all channels written).\n * @returns An operand whose `texture` holds the GPU result, or whose `factor` holds the CPU-folded constant\n */\nexport async function MaxTexturesAsync(\n name: string,\n a: ITextureProcessOperand,\n b: ITextureProcessOperand,\n scene: Scene,\n outputColorSpace?: TextureColorSpace,\n outputChannelMask?: ChannelMask\n): Promise<ITextureProcessOperand> {\n if (!a.texture && !b.texture) {\n const factor = _MaxConstants(_EvalConstant(a), _EvalConstant(b));\n return { texture: null, factor: outputChannelMask ? _ApplyOutputChannelMask(factor, outputChannelMask) : factor };\n }\n\n const allTextures: BaseTexture[] = [];\n if (a.texture) {\n allTextures.push(a.texture);\n }\n if (b.texture) {\n allTextures.push(b.texture);\n }\n const canPropagate = _AllTransformsMatch(allTextures);\n const bakeTransform = !canPropagate;\n\n const defines = [\n \"OP_MAX\",\n ..._BuildOperandDefines(a, \"A\", bakeTransform),\n ..._BuildOperandDefines(b, \"B\", bakeTransform),\n ...(outputChannelMask ? _BuildOutputChannelMaskDefines(outputChannelMask) : []),\n ];\n if (outputColorSpace) {\n defines.push(\"OUTPUT_SRGB\");\n }\n const pt = _CreateProcessorTexture(name, defines, _ResolveOutputSize([a, b]), scene, outputColorSpace);\n _SetOperandUniforms(pt, a, \"textureA\", \"factorA\", bakeTransform);\n _SetOperandUniforms(pt, b, \"textureB\", \"factorB\", bakeTransform);\n try {\n await _RenderAsync(pt);\n } catch (error) {\n a.dispose?.();\n b.dispose?.();\n throw error;\n }\n\n a.dispose?.();\n b.dispose?.();\n\n _CopyTextureMetadata(allTextures[0], pt, canPropagate);\n const result: ITextureProcessOperand = { texture: pt, dispose: () => pt.dispose() };\n if (outputColorSpace) {\n result.colorSpace = outputColorSpace;\n }\n return result;\n}\n\n/**\n * Linearly interpolate between two texture operands: `result = mix(a, b, t)`.\n *\n * Each operand can be a texture, a constant factor, or a texture scaled by a factor.\n * The `t` operand controls the blend weight per texel, per channel — a value of 0 returns `a`,\n * a value of 1 returns `b`. Use a grayscale texture or a scalar `Color4(v, v, v, v)` for\n * uniform blending across all channels.\n *\n * If all three operands are constant (no textures), the interpolation is performed on the CPU and\n * the result is returned as a factor-only operand with no texture allocated.\n *\n * When operands are results of previous operations (i.e. they carry a `dispose` function),\n * their intermediate textures are automatically released after the GPU pass completes.\n *\n * @param name - Name for the resulting procedural texture (used only when a GPU pass is needed)\n * @param a - Start value operand (returned when t = 0)\n * @param b - End value operand (returned when t = 1)\n * @param t - Blend weight operand. Each channel independently controls the blend for the corresponding output channel.\n * @param scene - Scene to create the texture in (used only when a GPU pass is needed)\n * @param outputColorSpace - Optional output color space. When `TextureColorSpace.SRGB`, the linear\n * result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to `TextureColorSpace.Linear`.\n * @param outputChannelMask - Optional bitmask of channels to write. Excluded color channels are set to\n * `0.0`; excluded alpha is set to `1.0`. Defaults to `ChannelMask.RGBA` (all channels written).\n * @returns An operand whose `texture` holds the GPU result, or whose `factor` holds the CPU-folded constant\n */\nexport async function LerpTexturesAsync(\n name: string,\n a: ITextureProcessOperand,\n b: ITextureProcessOperand,\n t: ITextureProcessOperand,\n scene: Scene,\n outputColorSpace?: TextureColorSpace,\n outputChannelMask?: ChannelMask\n): Promise<ITextureProcessOperand> {\n if (!a.texture && !b.texture && !t.texture) {\n const factor = _LerpConstants(_EvalConstant(a), _EvalConstant(b), _EvalConstant(t));\n return { texture: null, factor: outputChannelMask ? _ApplyOutputChannelMask(factor, outputChannelMask) : factor };\n }\n\n const allTextures: BaseTexture[] = [];\n if (a.texture) {\n allTextures.push(a.texture);\n }\n if (b.texture) {\n allTextures.push(b.texture);\n }\n if (t.texture) {\n allTextures.push(t.texture);\n }\n const canPropagate = _AllTransformsMatch(allTextures);\n const bakeTransform = !canPropagate;\n\n const defines = [\n \"OP_LERP\",\n ..._BuildOperandDefines(a, \"A\", bakeTransform),\n ..._BuildOperandDefines(b, \"B\", bakeTransform),\n ..._BuildLerpBlendDefines(t, bakeTransform),\n ...(outputChannelMask ? _BuildOutputChannelMaskDefines(outputChannelMask) : []),\n ];\n if (outputColorSpace) {\n defines.push(\"OUTPUT_SRGB\");\n }\n const pt = _CreateProcessorTexture(name, defines, _ResolveOutputSize([a, b, t]), scene, outputColorSpace);\n _SetOperandUniforms(pt, a, \"textureA\", \"factorA\", bakeTransform);\n _SetOperandUniforms(pt, b, \"textureB\", \"factorB\", bakeTransform);\n _SetLerpBlendUniforms(pt, t, bakeTransform);\n try {\n await _RenderAsync(pt);\n } catch (error) {\n a.dispose?.();\n b.dispose?.();\n t.dispose?.();\n throw error;\n }\n\n a.dispose?.();\n b.dispose?.();\n t.dispose?.();\n\n _CopyTextureMetadata(allTextures[0], pt, canPropagate);\n const result: ITextureProcessOperand = { texture: pt, dispose: () => pt.dispose() };\n if (outputColorSpace) {\n result.colorSpace = outputColorSpace;\n }\n return result;\n}\n\n/**\n * Invert selected channels of a texture operand: `result[ch] = 1 - input[ch]`.\n *\n * The `channels` bitmask selects which channels are inverted; unselected channels pass through\n * unchanged. Use `ChannelMask.RGB` for the common roughness↔smoothness conversion, or\n * `ChannelMask.RGBA` (the default) to invert the entire texture.\n *\n * This is a unary operation — only operand A is used. Any `colorSpace` or `channel` properties\n * on the input operand are honoured (sRGB linearization and channel swizzle applied before\n * the invert).\n *\n * If the input is constant (no texture), the invert is performed on the CPU.\n *\n * When the input is the result of a previous operation (i.e. it carries a `dispose` function),\n * its intermediate texture is automatically released after the GPU pass completes.\n *\n * @param name - Name for the resulting procedural texture (used only when a GPU pass is needed)\n * @param input - Operand to invert\n * @param scene - Scene to create the texture in (used only when a GPU pass is needed)\n * @param channels - Bitmask of channels to invert. Defaults to `ChannelMask.RGBA`.\n * @param outputColorSpace - Optional output color space. When `TextureColorSpace.SRGB`, the linear\n * result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to `TextureColorSpace.Linear`.\n * @param outputChannelMask - Optional bitmask of channels to write. Excluded color channels are set to\n * `0.0`; excluded alpha is set to `1.0`. Defaults to `ChannelMask.RGBA` (all channels written).\n * @returns An operand whose `texture` holds the GPU result, or whose `factor` holds the CPU-folded constant\n */\nexport async function InvertTextureAsync(\n name: string,\n input: ITextureProcessOperand,\n scene: Scene,\n channels: ChannelMask = ChannelMask.RGBA,\n outputColorSpace?: TextureColorSpace,\n outputChannelMask?: ChannelMask\n): Promise<ITextureProcessOperand> {\n if (!input.texture) {\n const c = _EvalConstant(input);\n const factor = new Color4(\n channels & ChannelMask.R ? 1 - c.r : c.r,\n channels & ChannelMask.G ? 1 - c.g : c.g,\n channels & ChannelMask.B ? 1 - c.b : c.b,\n channels & ChannelMask.A ? 1 - c.a : c.a\n );\n return { texture: null, factor: outputChannelMask ? _ApplyOutputChannelMask(factor, outputChannelMask) : factor };\n }\n\n // Single input: UV transform is always propagated (no bake needed).\n const defines = [..._BuildOperandDefines(input, \"A\", false), ..._BuildInvertDefines(channels), ...(outputChannelMask ? _BuildOutputChannelMaskDefines(outputChannelMask) : [])];\n if (outputColorSpace) {\n defines.push(\"OUTPUT_SRGB\");\n }\n const pt = _CreateProcessorTexture(name, defines, _ResolveOutputSize([input]), scene, outputColorSpace);\n _SetOperandUniforms(pt, input, \"textureA\", \"factorA\", false);\n try {\n await _RenderAsync(pt);\n } catch (error) {\n input.dispose?.();\n throw error;\n }\n\n input.dispose?.();\n\n _CopyTextureMetadata(input.texture, pt, true);\n const result: ITextureProcessOperand = { texture: pt, dispose: () => pt.dispose() };\n if (outputColorSpace) {\n result.colorSpace = outputColorSpace;\n }\n return result;\n}\n\n/**\n * Extract the per-texel maximum channel value from a texture and broadcast it to all output\n * channels, producing a single-value (greyscale) texture in a single GPU pass.\n *\n * For each texel, computes `max(r, g, b)` — or `max(r, g, b, a)` when `includeAlpha` is true —\n * and writes that scalar to the output:\n * - `includeAlpha = false` (default): output is `(m, m, m, a)` where `m = max(r, g, b)`\n * - `includeAlpha = true`: output is `(m, m, m, m)` where `m = max(r, g, b, a)`\n *\n * This is more efficient than chaining `ExtractChannelAsync` calls through `MaxTexturesAsync`,\n * which would require multiple intermediate textures and GPU passes.\n *\n * Any `colorSpace` or `channel` properties on the input operand are honoured (sRGB linearization\n * and channel swizzle applied before the max reduction).\n *\n * If the input is constant (no texture), the reduction is performed on the CPU.\n *\n * When the input is the result of a previous operation (i.e. it carries a `dispose` function),\n * its intermediate texture is automatically released after the GPU pass completes.\n *\n * @param name - Name for the resulting procedural texture (used only when a GPU pass is needed)\n * @param input - Operand to reduce\n * @param scene - Scene to create the texture in (used only when a GPU pass is needed)\n * @param includeAlpha - When true, alpha participates in the max and is also set to the result.\n * Defaults to false (alpha is preserved from the input).\n * @param outputColorSpace - Optional output color space. When `TextureColorSpace.SRGB`, the linear\n * result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to `TextureColorSpace.Linear`.\n * @param outputChannelMask - Optional bitmask of channels to write. Excluded color channels are set to\n * `0.0`; excluded alpha is set to `1.0`. Defaults to `ChannelMask.RGBA` (all channels written).\n * @returns An operand whose `texture` holds the GPU result, or whose `factor` holds the CPU-folded constant\n */\nexport async function ExtractMaxChannelAsync(\n name: string,\n input: ITextureProcessOperand,\n scene: Scene,\n includeAlpha: boolean = false,\n outputColorSpace?: TextureColorSpace,\n outputChannelMask?: ChannelMask\n): Promise<ITextureProcessOperand> {\n if (!input.texture) {\n const c = _EvalConstant(input);\n const m = includeAlpha ? Math.max(c.r, c.g, c.b, c.a) : Math.max(c.r, c.g, c.b);\n const factor = new Color4(m, m, m, includeAlpha ? m : c.a);\n return { texture: null, factor: outputChannelMask ? _ApplyOutputChannelMask(factor, outputChannelMask) : factor };\n }\n\n // Single input: UV transform is always propagated (no bake needed).\n const defines = [..._BuildOperandDefines(input, \"A\", false), \"OP_CHANNEL_MAX\", ...(outputChannelMask ? _BuildOutputChannelMaskDefines(outputChannelMask) : [])];\n if (includeAlpha) {\n defines.push(\"CHANNEL_MAX_INCLUDE_ALPHA\");\n }\n if (outputColorSpace) {\n defines.push(\"OUTPUT_SRGB\");\n }\n const pt = _CreateProcessorTexture(name, defines, _ResolveOutputSize([input]), scene, outputColorSpace);\n _SetOperandUniforms(pt, input, \"textureA\", \"factorA\", false);\n try {\n await _RenderAsync(pt);\n } catch (error) {\n input.dispose?.();\n throw error;\n }\n\n input.dispose?.();\n\n _CopyTextureMetadata(input.texture, pt, true);\n const result: ITextureProcessOperand = { texture: pt, dispose: () => pt.dispose() };\n if (outputColorSpace) {\n result.colorSpace = outputColorSpace;\n }\n return result;\n}\n\n/**\n * Extract a single channel from a texture and broadcast it to RGB (or all four components for\n * `TextureChannel.A`), producing a new texture. This is a convenience wrapper over\n * `MultiplyTexturesAsync` with a `(1,1,1,1)` factor and the requested channel swizzle applied\n * to the input.\n *\n * Swizzle results per channel:\n * - `TextureChannel.R` → (r, r, r, a)\n * - `TextureChannel.G` → (g, g, g, a)\n * - `TextureChannel.B` → (b, b, b, a)\n * - `TextureChannel.A` → (a, a, a, a)\n *\n * If the input is constant (no texture), the swizzle is applied on the CPU.\n *\n * Any `colorSpace` property on the input operand is honoured (sRGB linearization applied before\n * the swizzle). Any existing `channel` on the input is replaced by the `channel` argument.\n *\n * When the input is the result of a previous operation (i.e. it carries a `dispose` function),\n * its intermediate texture is automatically released after the GPU pass completes.\n *\n * @param name - Name for the resulting procedural texture (used only when a GPU pass is needed)\n * @param input - Operand to extract the channel from\n * @param channel - The channel to extract and broadcast\n * @param scene - Scene to create the texture in (used only when a GPU pass is needed)\n * @param outputColorSpace - Optional output color space. When `TextureColorSpace.SRGB`, the linear\n * result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to `TextureColorSpace.Linear`.\n * @param outputChannelMask - Optional bitmask of channels to write. Excluded color channels are set to\n * `0.0`; excluded alpha is set to `1.0`. Defaults to `ChannelMask.RGBA` (all channels written).\n * @returns An operand whose `texture` holds the GPU result, or whose `factor` holds the CPU-folded constant\n */\nexport async function ExtractChannelAsync(\n name: string,\n input: ITextureProcessOperand,\n channel: TextureChannel,\n scene: Scene,\n outputColorSpace?: TextureColorSpace,\n outputChannelMask?: ChannelMask\n): Promise<ITextureProcessOperand> {\n if (!input.texture) {\n const swizzled = _ApplyChannelSwizzle(_EvalConstant(input), channel);\n return { texture: null, factor: outputChannelMask ? _ApplyOutputChannelMask(swizzled, outputChannelMask) : swizzled };\n }\n return await MultiplyTexturesAsync(name, { ...input, channel }, CreateFactorOperand(new Color4(1, 1, 1, 1)), scene, outputColorSpace, outputChannelMask);\n}\n"]}
@@ -282,6 +282,30 @@ export declare class Material implements IAnimatable, IClipPlanesHolder {
282
282
  * Gets the culling state
283
283
  */
284
284
  get backFaceCulling(): boolean;
285
+ protected _textureRepetitionMode: number;
286
+ /**
287
+ * Sets the texture repetition breaking mode.
288
+ * Use one of the Constants.TEXTURE_REPETITION_* values to break visible texture tiling patterns.
289
+ * Ordered by cost: NONE (1 fetch), NOISE_BLEND (3), HEX_TILING (3), TILE_RANDOMIZATION (4), VORONOI_BOMBING (9).
290
+ * Not supported on WebGL1 — the mode will be forced to NONE.
291
+ * @see https://iquilezles.org/articles/texturerepetition/
292
+ * @see https://jcgt.org/published/0011/03/05/
293
+ */
294
+ set textureRepetitionMode(value: number);
295
+ /**
296
+ * Gets the texture repetition breaking mode.
297
+ * @see https://iquilezles.org/articles/texturerepetition/
298
+ */
299
+ get textureRepetitionMode(): number;
300
+ /**
301
+ * Parameters for the hex tiling texture repetition mode (TEXTURE_REPETITION_HEX_TILING).
302
+ * x = rotation strength (0..1, default 1.0) — how much each hex tile is rotated.
303
+ * y = fall-off contrast (0..1, default 0.6) — how much luminance affects blending weight at tile borders.
304
+ * z = exponent (1..20, default 7.0) — controls the sharpness of weight falloff between tiles.
305
+ * w = contrast (0..1, default 0.5) — boost blending contrast via Gain3 (0.5 = neutral, &gt;0.5 = higher contrast).
306
+ * @see https://jcgt.org/published/0011/03/05/
307
+ */
308
+ textureRepetitionHexTilingParams: number[];
285
309
  /**
286
310
  * Specifies if back or front faces should be culled (when culling is enabled)
287
311
  */
@@ -95,6 +95,29 @@ export class Material {
95
95
  get backFaceCulling() {
96
96
  return this._backFaceCulling;
97
97
  }
98
+ /**
99
+ * Sets the texture repetition breaking mode.
100
+ * Use one of the undefined* values to break visible texture tiling patterns.
101
+ * Ordered by cost: NONE (1 fetch), NOISE_BLEND (3), HEX_TILING (3), TILE_RANDOMIZATION (4), VORONOI_BOMBING (9).
102
+ * Not supported on WebGL1 — the mode will be forced to NONE.
103
+ * @see https://iquilezles.org/articles/texturerepetition/
104
+ * @see https://jcgt.org/published/0011/03/05/
105
+ */
106
+ set textureRepetitionMode(value) {
107
+ const clamped = Math.max(0, Math.min(value | 0, 4));
108
+ if (this._textureRepetitionMode === clamped) {
109
+ return;
110
+ }
111
+ this._textureRepetitionMode = clamped;
112
+ this.markAsDirty(Material.TextureDirtyFlag);
113
+ }
114
+ /**
115
+ * Gets the texture repetition breaking mode.
116
+ * @see https://iquilezles.org/articles/texturerepetition/
117
+ */
118
+ get textureRepetitionMode() {
119
+ return this._textureRepetitionMode;
120
+ }
98
121
  /**
99
122
  * Sets the type of faces that should be culled (true for back faces, false for front faces)
100
123
  */
@@ -437,6 +460,16 @@ export class Material {
437
460
  * Specifies if back face culling is enabled
438
461
  */
439
462
  this._backFaceCulling = true;
463
+ this._textureRepetitionMode = 0;
464
+ /**
465
+ * Parameters for the hex tiling texture repetition mode (TEXTURE_REPETITION_HEX_TILING).
466
+ * x = rotation strength (0..1, default 1.0) — how much each hex tile is rotated.
467
+ * y = fall-off contrast (0..1, default 0.6) — how much luminance affects blending weight at tile borders.
468
+ * z = exponent (1..20, default 7.0) — controls the sharpness of weight falloff between tiles.
469
+ * w = contrast (0..1, default 0.5) — boost blending contrast via Gain3 (0.5 = neutral, &gt;0.5 = higher contrast).
470
+ * @see https://jcgt.org/published/0011/03/05/
471
+ */
472
+ this.textureRepetitionHexTilingParams = [1.0, 0.6, 7.0, 0.5];
440
473
  /**
441
474
  * Specifies if back or front faces should be culled (when culling is enabled)
442
475
  */
@@ -1690,6 +1723,12 @@ __decorate([
1690
1723
  __decorate([
1691
1724
  serialize("backFaceCulling")
1692
1725
  ], Material.prototype, "_backFaceCulling", void 0);
1726
+ __decorate([
1727
+ serialize("textureRepetitionMode")
1728
+ ], Material.prototype, "_textureRepetitionMode", void 0);
1729
+ __decorate([
1730
+ serialize("textureRepetitionHexTilingParams")
1731
+ ], Material.prototype, "textureRepetitionHexTilingParams", void 0);
1693
1732
  __decorate([
1694
1733
  serialize("cullBackFaces")
1695
1734
  ], Material.prototype, "_cullBackFaces", void 0);