babylon.skyMaterial.d.ts 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. declare module BABYLON {
  2. /**
  3. * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
  4. * @see https://doc.babylonjs.com/extensions/sky
  5. */
  6. class SkyMaterial extends PushMaterial {
  7. /**
  8. * Defines the overall luminance of sky in interval ]0, 1[.
  9. */
  10. luminance: number;
  11. /**
  12. * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
  13. */
  14. turbidity: number;
  15. /**
  16. * Defines the sky appearance (light intensity).
  17. */
  18. rayleigh: number;
  19. /**
  20. * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
  21. */
  22. mieCoefficient: number;
  23. /**
  24. * Defines the amount of haze particles following the Mie scattering theory.
  25. */
  26. mieDirectionalG: number;
  27. /**
  28. * Defines the distance of the sun according to the active scene camera.
  29. */
  30. distance: number;
  31. /**
  32. * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
  33. * "inclined".
  34. */
  35. inclination: number;
  36. /**
  37. * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
  38. * an object direction and a reference direction.
  39. */
  40. azimuth: number;
  41. /**
  42. * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
  43. * the property is overriden by the inclination and the azimuth and can be read at any moment.
  44. */
  45. sunPosition: Vector3;
  46. /**
  47. * Defines if the sun position should be computed (inclination and azimuth) according to the given
  48. * .sunPosition property.
  49. */
  50. useSunPosition: boolean;
  51. /**
  52. * Defines an offset vector used to get a horizon offset.
  53. * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
  54. */
  55. cameraOffset: Vector3;
  56. private _cameraPosition;
  57. private _renderId;
  58. /**
  59. * Instantiates a new sky material.
  60. * This material allows to create dynamic and texture free
  61. * effects for skyboxes by taking care of the atmosphere state.
  62. * @see https://doc.babylonjs.com/extensions/sky
  63. * @param name Define the name of the material in the scene
  64. * @param scene Define the scene the material belong to
  65. */
  66. constructor(name: string, scene: Scene);
  67. /**
  68. * Specifies if the material will require alpha blending
  69. * @returns a boolean specifying if alpha blending is needed
  70. */
  71. needAlphaBlending(): boolean;
  72. /**
  73. * Specifies if this material should be rendered in alpha test mode
  74. * @returns false as the sky material doesn't need alpha testing.
  75. */
  76. needAlphaTesting(): boolean;
  77. /**
  78. * Get the texture used for alpha test purpose.
  79. * @returns null as the sky material has no texture.
  80. */
  81. getAlphaTestTexture(): Nullable<BaseTexture>;
  82. /**
  83. * Get if the submesh is ready to be used and all its information available.
  84. * Child classes can use it to update shaders
  85. * @param mesh defines the mesh to check
  86. * @param subMesh defines which submesh to check
  87. * @param useInstances specifies that instances should be used
  88. * @returns a boolean indicating that the submesh is ready or not
  89. */
  90. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  91. /**
  92. * Binds the submesh to this material by preparing the effect and shader to draw
  93. * @param world defines the world transformation matrix
  94. * @param mesh defines the mesh containing the submesh
  95. * @param subMesh defines the submesh to bind the material to
  96. */
  97. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  98. /**
  99. * Get the list of animatables in the material.
  100. * @returns the list of animatables object used in the material
  101. */
  102. getAnimatables(): IAnimatable[];
  103. /**
  104. * Disposes the material
  105. * @param forceDisposeEffect specifies if effects should be forcefully disposed
  106. */
  107. dispose(forceDisposeEffect?: boolean): void;
  108. /**
  109. * Makes a duplicate of the material, and gives it a new name
  110. * @param name defines the new name for the duplicated material
  111. * @returns the cloned material
  112. */
  113. clone(name: string): SkyMaterial;
  114. /**
  115. * Serializes this material in a JSON representation
  116. * @returns the serialized material object
  117. */
  118. serialize(): any;
  119. /**
  120. * Gets the current class name of the material e.g. "SkyMaterial"
  121. * Mainly use in serialization.
  122. * @returns the class name
  123. */
  124. getClassName(): string;
  125. /**
  126. * Creates a sky material from parsed material data
  127. * @param source defines the JSON representation of the material
  128. * @param scene defines the hosting scene
  129. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  130. * @returns a new sky material
  131. */
  132. static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial;
  133. }
  134. }