fresnelParameters.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import type { DeepImmutable } from "../types";
  2. import { Color3 } from "../Maths/math.color";
  3. /**
  4. * Options to be used when creating a FresnelParameters.
  5. */
  6. export type IFresnelParametersCreationOptions = {
  7. /**
  8. * Define the color used on edges (grazing angle)
  9. */
  10. leftColor?: Color3;
  11. /**
  12. * Define the color used on center
  13. */
  14. rightColor?: Color3;
  15. /**
  16. * Define bias applied to computed fresnel term
  17. */
  18. bias?: number;
  19. /**
  20. * Defined the power exponent applied to fresnel term
  21. */
  22. power?: number;
  23. /**
  24. * Define if the fresnel effect is enable or not.
  25. */
  26. isEnabled?: boolean;
  27. };
  28. /**
  29. * Serialized format for FresnelParameters.
  30. */
  31. export type IFresnelParametersSerialized = {
  32. /**
  33. * Define the color used on edges (grazing angle) [as an array]
  34. */
  35. leftColor: number[];
  36. /**
  37. * Define the color used on center [as an array]
  38. */
  39. rightColor: number[];
  40. /**
  41. * Define bias applied to computed fresnel term
  42. */
  43. bias: number;
  44. /**
  45. * Defined the power exponent applied to fresnel term
  46. */
  47. power?: number;
  48. /**
  49. * Define if the fresnel effect is enable or not.
  50. */
  51. isEnabled: boolean;
  52. };
  53. /**
  54. * This represents all the required information to add a fresnel effect on a material:
  55. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
  56. */
  57. export declare class FresnelParameters {
  58. private _isEnabled;
  59. /**
  60. * Define if the fresnel effect is enable or not.
  61. */
  62. get isEnabled(): boolean;
  63. set isEnabled(value: boolean);
  64. /**
  65. * Define the color used on edges (grazing angle)
  66. */
  67. leftColor: Color3;
  68. /**
  69. * Define the color used on center
  70. */
  71. rightColor: Color3;
  72. /**
  73. * Define bias applied to computed fresnel term
  74. */
  75. bias: number;
  76. /**
  77. * Defined the power exponent applied to fresnel term
  78. */
  79. power: number;
  80. /**
  81. * Creates a new FresnelParameters object.
  82. *
  83. * @param options provide your own settings to optionally to override defaults
  84. */
  85. constructor(options?: IFresnelParametersCreationOptions);
  86. /**
  87. * Clones the current fresnel and its values
  88. * @returns a clone fresnel configuration
  89. */
  90. clone(): FresnelParameters;
  91. /**
  92. * Determines equality between FresnelParameters objects
  93. * @param otherFresnelParameters defines the second operand
  94. * @returns true if the power, bias, leftColor, rightColor and isEnabled values are equal to the given ones
  95. */
  96. equals(otherFresnelParameters: DeepImmutable<FresnelParameters>): boolean;
  97. /**
  98. * Serializes the current fresnel parameters to a JSON representation.
  99. * @returns the JSON serialization
  100. */
  101. serialize(): IFresnelParametersSerialized;
  102. /**
  103. * Parse a JSON object and deserialize it to a new Fresnel parameter object.
  104. * @param parsedFresnelParameters Define the JSON representation
  105. * @returns the parsed parameters
  106. */
  107. static Parse(parsedFresnelParameters: IFresnelParametersSerialized): FresnelParameters;
  108. }