pbrClearCoatConfiguration.d.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import type { Nullable } from "../../types";
  2. import { Color3 } from "../../Maths/math.color";
  3. import type { BaseTexture } from "../../Materials/Textures/baseTexture";
  4. import type { UniformBuffer } from "../../Materials/uniformBuffer";
  5. import type { IAnimatable } from "../../Animations/animatable.interface";
  6. import type { EffectFallbacks } from "../effectFallbacks";
  7. import type { SubMesh } from "../../Meshes/subMesh";
  8. import { MaterialPluginBase } from "../materialPluginBase";
  9. import { MaterialDefines } from "../materialDefines";
  10. import type { Engine } from "../../Engines/engine";
  11. import type { Scene } from "../../scene";
  12. import type { PBRBaseMaterial } from "./pbrBaseMaterial";
  13. /**
  14. * @internal
  15. */
  16. export declare class MaterialClearCoatDefines extends MaterialDefines {
  17. CLEARCOAT: boolean;
  18. CLEARCOAT_DEFAULTIOR: boolean;
  19. CLEARCOAT_TEXTURE: boolean;
  20. CLEARCOAT_TEXTURE_ROUGHNESS: boolean;
  21. CLEARCOAT_TEXTUREDIRECTUV: number;
  22. CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV: number;
  23. CLEARCOAT_BUMP: boolean;
  24. CLEARCOAT_BUMPDIRECTUV: number;
  25. CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE: boolean;
  26. CLEARCOAT_REMAP_F0: boolean;
  27. CLEARCOAT_TINT: boolean;
  28. CLEARCOAT_TINT_TEXTURE: boolean;
  29. CLEARCOAT_TINT_TEXTUREDIRECTUV: number;
  30. CLEARCOAT_TINT_GAMMATEXTURE: boolean;
  31. }
  32. /**
  33. * Plugin that implements the clear coat component of the PBR material
  34. */
  35. export declare class PBRClearCoatConfiguration extends MaterialPluginBase {
  36. protected _material: PBRBaseMaterial;
  37. /**
  38. * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence
  39. * The default fits with a polyurethane material.
  40. * @internal
  41. */
  42. static readonly _DefaultIndexOfRefraction = 1.5;
  43. private _isEnabled;
  44. /**
  45. * Defines if the clear coat is enabled in the material.
  46. */
  47. isEnabled: boolean;
  48. /**
  49. * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.
  50. */
  51. intensity: number;
  52. /**
  53. * Defines the clear coat layer roughness.
  54. */
  55. roughness: number;
  56. private _indexOfRefraction;
  57. /**
  58. * Defines the index of refraction of the clear coat.
  59. * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence
  60. * The default fits with a polyurethane material.
  61. * Changing the default value is more performance intensive.
  62. */
  63. indexOfRefraction: number;
  64. private _texture;
  65. /**
  66. * Stores the clear coat values in a texture (red channel is intensity and green channel is roughness)
  67. * If useRoughnessFromMainTexture is false, the green channel of texture is not used and the green channel of textureRoughness is used instead
  68. * if textureRoughness is not empty, else no texture roughness is used
  69. */
  70. texture: Nullable<BaseTexture>;
  71. private _useRoughnessFromMainTexture;
  72. /**
  73. * Indicates that the green channel of the texture property will be used for roughness (default: true)
  74. * If false, the green channel from textureRoughness is used for roughness
  75. */
  76. useRoughnessFromMainTexture: boolean;
  77. private _textureRoughness;
  78. /**
  79. * Stores the clear coat roughness in a texture (green channel)
  80. * Not used if useRoughnessFromMainTexture is true
  81. */
  82. textureRoughness: Nullable<BaseTexture>;
  83. private _remapF0OnInterfaceChange;
  84. /**
  85. * Defines if the F0 value should be remapped to account for the interface change in the material.
  86. */
  87. remapF0OnInterfaceChange: boolean;
  88. private _bumpTexture;
  89. /**
  90. * Define the clear coat specific bump texture.
  91. */
  92. bumpTexture: Nullable<BaseTexture>;
  93. private _isTintEnabled;
  94. /**
  95. * Defines if the clear coat tint is enabled in the material.
  96. */
  97. isTintEnabled: boolean;
  98. /**
  99. * Defines the clear coat tint of the material.
  100. * This is only use if tint is enabled
  101. */
  102. tintColor: Color3;
  103. /**
  104. * Defines the distance at which the tint color should be found in the
  105. * clear coat media.
  106. * This is only use if tint is enabled
  107. */
  108. tintColorAtDistance: number;
  109. /**
  110. * Defines the clear coat layer thickness.
  111. * This is only use if tint is enabled
  112. */
  113. tintThickness: number;
  114. private _tintTexture;
  115. /**
  116. * Stores the clear tint values in a texture.
  117. * rgb is tint
  118. * a is a thickness factor
  119. */
  120. tintTexture: Nullable<BaseTexture>;
  121. /** @internal */
  122. private _internalMarkAllSubMeshesAsTexturesDirty;
  123. /** @internal */
  124. _markAllSubMeshesAsTexturesDirty(): void;
  125. constructor(material: PBRBaseMaterial, addToPluginList?: boolean);
  126. isReadyForSubMesh(defines: MaterialClearCoatDefines, scene: Scene, engine: Engine): boolean;
  127. prepareDefinesBeforeAttributes(defines: MaterialClearCoatDefines, scene: Scene): void;
  128. bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, engine: Engine, subMesh: SubMesh): void;
  129. hasTexture(texture: BaseTexture): boolean;
  130. getActiveTextures(activeTextures: BaseTexture[]): void;
  131. getAnimatables(animatables: IAnimatable[]): void;
  132. dispose(forceDisposeTextures?: boolean): void;
  133. getClassName(): string;
  134. addFallbacks(defines: MaterialClearCoatDefines, fallbacks: EffectFallbacks, currentRank: number): number;
  135. getSamplers(samplers: string[]): void;
  136. getUniforms(): {
  137. ubo?: Array<{
  138. name: string;
  139. size: number;
  140. type: string;
  141. }>;
  142. vertex?: string;
  143. fragment?: string;
  144. };
  145. }