pbrAnisotropicConfiguration.d.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import type { UniformBuffer } from "../../Materials/uniformBuffer";
  2. import { Vector2 } from "../../Maths/math.vector";
  3. import type { BaseTexture } from "../../Materials/Textures/baseTexture";
  4. import type { Nullable } from "../../types";
  5. import type { IAnimatable } from "../../Animations/animatable.interface";
  6. import type { EffectFallbacks } from "../effectFallbacks";
  7. import { MaterialPluginBase } from "../materialPluginBase";
  8. import { MaterialDefines } from "../materialDefines";
  9. import type { Scene } from "../../scene";
  10. import type { AbstractMesh } from "../../Meshes/abstractMesh";
  11. import type { PBRBaseMaterial } from "./pbrBaseMaterial";
  12. /**
  13. * @internal
  14. */
  15. export declare class MaterialAnisotropicDefines extends MaterialDefines {
  16. ANISOTROPIC: boolean;
  17. ANISOTROPIC_TEXTURE: boolean;
  18. ANISOTROPIC_TEXTUREDIRECTUV: number;
  19. ANISOTROPIC_LEGACY: boolean;
  20. MAINUV1: boolean;
  21. }
  22. /**
  23. * Plugin that implements the anisotropic component of the PBR material
  24. */
  25. export declare class PBRAnisotropicConfiguration extends MaterialPluginBase {
  26. private _isEnabled;
  27. /**
  28. * Defines if the anisotropy is enabled in the material.
  29. */
  30. isEnabled: boolean;
  31. /**
  32. * Defines the anisotropy strength (between 0 and 1) it defaults to 1.
  33. */
  34. intensity: number;
  35. /**
  36. * Defines if the effect is along the tangents, bitangents or in between.
  37. * By default, the effect is "stretching" the highlights along the tangents.
  38. */
  39. direction: Vector2;
  40. /**
  41. * Sets the anisotropy direction as an angle.
  42. */
  43. set angle(value: number);
  44. /**
  45. * Gets the anisotropy angle value in radians.
  46. * @returns the anisotropy angle value in radians.
  47. */
  48. get angle(): number;
  49. private _texture;
  50. /**
  51. * Stores the anisotropy values in a texture.
  52. * rg is direction (like normal from -1 to 1)
  53. * b is a intensity
  54. */
  55. texture: Nullable<BaseTexture>;
  56. private _legacy;
  57. /**
  58. * Defines if the anisotropy is in legacy mode for backwards compatibility before 6.4.0.
  59. */
  60. legacy: boolean;
  61. /** @internal */
  62. private _internalMarkAllSubMeshesAsTexturesDirty;
  63. /** @internal */
  64. _markAllSubMeshesAsTexturesDirty(): void;
  65. /** @internal */
  66. private _internalMarkAllSubMeshesAsMiscDirty;
  67. /** @internal */
  68. _markAllSubMeshesAsMiscDirty(): void;
  69. constructor(material: PBRBaseMaterial, addToPluginList?: boolean);
  70. isReadyForSubMesh(defines: MaterialAnisotropicDefines, scene: Scene): boolean;
  71. prepareDefinesBeforeAttributes(defines: MaterialAnisotropicDefines, scene: Scene, mesh: AbstractMesh): void;
  72. bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene): void;
  73. hasTexture(texture: BaseTexture): boolean;
  74. getActiveTextures(activeTextures: BaseTexture[]): void;
  75. getAnimatables(animatables: IAnimatable[]): void;
  76. dispose(forceDisposeTextures?: boolean): void;
  77. getClassName(): string;
  78. addFallbacks(defines: MaterialAnisotropicDefines, fallbacks: EffectFallbacks, currentRank: number): number;
  79. getSamplers(samplers: string[]): void;
  80. getUniforms(): {
  81. ubo?: Array<{
  82. name: string;
  83. size: number;
  84. type: string;
  85. }>;
  86. vertex?: string;
  87. fragment?: string;
  88. };
  89. /**
  90. * Parses a anisotropy Configuration from a serialized object.
  91. * @param source - Serialized object.
  92. * @param scene Defines the scene we are parsing for
  93. * @param rootUrl Defines the rootUrl to load from
  94. */
  95. parse(source: any, scene: Scene, rootUrl: string): void;
  96. }