equiRectangularCubeTexture.d.ts 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { BaseTexture } from "./baseTexture";
  2. import type { Scene } from "../../scene";
  3. import type { Nullable } from "../../types";
  4. import "../../Engines/Extensions/engine.rawTexture";
  5. /**
  6. * This represents a texture coming from an equirectangular image supported by the web browser canvas.
  7. */
  8. export declare class EquiRectangularCubeTexture extends BaseTexture {
  9. /** The six faces of the cube. */
  10. private static _FacesMapping;
  11. private _noMipmap;
  12. private _onLoad;
  13. private _onError;
  14. /** The size of the cubemap. */
  15. private _size;
  16. /** Whether to supersample the input image */
  17. private _supersample;
  18. /** The buffer of the image. */
  19. private _buffer;
  20. /** The width of the input image. */
  21. private _width;
  22. /** The height of the input image. */
  23. private _height;
  24. /** The URL to the image. */
  25. url: string;
  26. /**
  27. * Instantiates an EquiRectangularCubeTexture from the following parameters.
  28. * @param url The location of the image
  29. * @param scene The scene the texture will be used in
  30. * @param size The cubemap desired size (the more it increases the longer the generation will be)
  31. * @param noMipmap Forces to not generate the mipmap if true
  32. * @param gammaSpace Specifies if the texture will be used in gamma or linear space
  33. * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)
  34. * @param onLoad — defines a callback called when texture is loaded
  35. * @param onError — defines a callback called if there is an error
  36. * @param supersample — defines if texture must be supersampled (default: false)
  37. */
  38. constructor(url: string, scene: Scene, size: number, noMipmap?: boolean, gammaSpace?: boolean, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, supersample?: boolean);
  39. /**
  40. * Load the image data, by putting the image on a canvas and extracting its buffer.
  41. * @param loadTextureCallback
  42. * @param onError
  43. */
  44. private _loadImage;
  45. /**
  46. * Convert the image buffer into a cubemap and create a CubeTexture.
  47. */
  48. private _loadTexture;
  49. /**
  50. * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.
  51. * @param buffer The ArrayBuffer that should be converted.
  52. * @returns The buffer as Float32Array.
  53. */
  54. private _getFloat32ArrayFromArrayBuffer;
  55. /**
  56. * Get the current class name of the texture useful for serialization or dynamic coding.
  57. * @returns "EquiRectangularCubeTexture"
  58. */
  59. getClassName(): string;
  60. /**
  61. * Create a clone of the current EquiRectangularCubeTexture and return it.
  62. * @returns A clone of the current EquiRectangularCubeTexture.
  63. */
  64. clone(): EquiRectangularCubeTexture;
  65. }