hdrCubeTexture.d.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import type { Nullable } from "../../types";
  2. import type { Scene } from "../../scene";
  3. import { Matrix, Vector3 } from "../../Maths/math.vector";
  4. import { BaseTexture } from "../../Materials/Textures/baseTexture";
  5. import { Observable } from "../../Misc/observable";
  6. import type { AbstractEngine } from "../../Engines/abstractEngine";
  7. import "../../Engines/Extensions/engine.rawTexture";
  8. import "../../Materials/Textures/baseTexture.polynomial";
  9. /**
  10. * This represents a texture coming from an HDR input.
  11. *
  12. * The only supported format is currently panorama picture stored in RGBE format.
  13. * Example of such files can be found on Poly Haven: https://polyhaven.com/hdris
  14. */
  15. export declare class HDRCubeTexture extends BaseTexture {
  16. private static _FacesMapping;
  17. private _generateHarmonics;
  18. private _noMipmap;
  19. private _prefilterOnLoad;
  20. private _textureMatrix;
  21. private _size;
  22. private _supersample;
  23. private _onLoad;
  24. private _onError;
  25. /**
  26. * The texture URL.
  27. */
  28. url: string;
  29. protected _isBlocking: boolean;
  30. /**
  31. * Sets whether or not the texture is blocking during loading.
  32. */
  33. set isBlocking(value: boolean);
  34. /**
  35. * Gets whether or not the texture is blocking during loading.
  36. */
  37. get isBlocking(): boolean;
  38. protected _rotationY: number;
  39. /**
  40. * Sets texture matrix rotation angle around Y axis in radians.
  41. */
  42. set rotationY(value: number);
  43. /**
  44. * Gets texture matrix rotation angle around Y axis radians.
  45. */
  46. get rotationY(): number;
  47. /**
  48. * Gets or sets the center of the bounding box associated with the cube texture
  49. * It must define where the camera used to render the texture was set
  50. */
  51. boundingBoxPosition: Vector3;
  52. private _boundingBoxSize;
  53. /**
  54. * Gets or sets the size of the bounding box associated with the cube texture
  55. * When defined, the cubemap will switch to local mode
  56. * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity
  57. * @example https://www.babylonjs-playground.com/#RNASML
  58. */
  59. set boundingBoxSize(value: Vector3);
  60. get boundingBoxSize(): Vector3;
  61. /**
  62. * Observable triggered once the texture has been loaded.
  63. */
  64. onLoadObservable: Observable<HDRCubeTexture>;
  65. /**
  66. * Instantiates an HDRTexture from the following parameters.
  67. *
  68. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  69. * @param sceneOrEngine The scene or engine the texture will be used in
  70. * @param size The cubemap desired size (the more it increases the longer the generation will be)
  71. * @param noMipmap Forces to not generate the mipmap if true
  72. * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
  73. * @param gammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
  74. * @param prefilterOnLoad Prefilters HDR texture to allow use of this texture as a PBR reflection texture.
  75. * @param onLoad on success callback function
  76. * @param onError on error callback function
  77. * @param supersample Defines if texture must be supersampled (default: false)
  78. */
  79. constructor(url: string, sceneOrEngine: Scene | AbstractEngine, size: number, noMipmap?: boolean, generateHarmonics?: boolean, gammaSpace?: boolean, prefilterOnLoad?: boolean, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, supersample?: boolean);
  80. /**
  81. * Get the current class name of the texture useful for serialization or dynamic coding.
  82. * @returns "HDRCubeTexture"
  83. */
  84. getClassName(): string;
  85. /**
  86. * Occurs when the file is raw .hdr file.
  87. */
  88. private _loadTexture;
  89. clone(): HDRCubeTexture;
  90. delayLoad(): void;
  91. /**
  92. * Get the texture reflection matrix used to rotate/transform the reflection.
  93. * @returns the reflection matrix
  94. */
  95. getReflectionTextureMatrix(): Matrix;
  96. /**
  97. * Set the texture reflection matrix used to rotate/transform the reflection.
  98. * @param value Define the reflection matrix to set
  99. */
  100. setReflectionTextureMatrix(value: Matrix): void;
  101. /**
  102. * Dispose the texture and release its associated resources.
  103. */
  104. dispose(): void;
  105. /**
  106. * Parses a JSON representation of an HDR Texture in order to create the texture
  107. * @param parsedTexture Define the JSON representation
  108. * @param scene Define the scene the texture should be created in
  109. * @param rootUrl Define the root url in case we need to load relative dependencies
  110. * @returns the newly created texture after parsing
  111. */
  112. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<HDRCubeTexture>;
  113. serialize(): any;
  114. }