hdr.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import type { CubeMapInfo } from "./panoramaToCubemap";
  2. /**
  3. * Header information of HDR texture files.
  4. */
  5. export interface HDRInfo {
  6. /**
  7. * The height of the texture in pixels.
  8. */
  9. height: number;
  10. /**
  11. * The width of the texture in pixels.
  12. */
  13. width: number;
  14. /**
  15. * The index of the beginning of the data in the binary file.
  16. */
  17. dataPosition: number;
  18. }
  19. /**
  20. * This groups tools to convert HDR texture to native colors array.
  21. */
  22. export declare class HDRTools {
  23. private static _Ldexp;
  24. private static _Rgbe2float;
  25. private static _ReadStringLine;
  26. /**
  27. * Reads header information from an RGBE texture stored in a native array.
  28. * More information on this format are available here:
  29. * https://en.wikipedia.org/wiki/RGBE_image_format
  30. *
  31. * @param uint8array The binary file stored in native array.
  32. * @returns The header information.
  33. */
  34. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  35. /**
  36. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  37. * This RGBE texture needs to store the information as a panorama.
  38. *
  39. * More information on this format are available here:
  40. * https://en.wikipedia.org/wiki/RGBE_image_format
  41. *
  42. * @param buffer The binary file stored in an array buffer.
  43. * @param size The expected size of the extracted cubemap.
  44. * @param supersample enable supersampling the cubemap (default: false)
  45. * @returns The Cube Map information.
  46. */
  47. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number, supersample?: boolean): CubeMapInfo;
  48. /**
  49. * Returns the pixels data extracted from an RGBE texture.
  50. * This pixels will be stored left to right up to down in the R G B order in one array.
  51. *
  52. * More information on this format are available here:
  53. * https://en.wikipedia.org/wiki/RGBE_image_format
  54. *
  55. * @param uint8array The binary file stored in an array buffer.
  56. * @param hdrInfo The header information of the file.
  57. * @returns The pixels data in RGB right to left up to down order.
  58. */
  59. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  60. private static _RGBEReadPixelsRLE;
  61. private static _RGBEReadPixelsNOTRLE;
  62. }