textureCreationOptions.d.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import type { InternalTexture } from "./internalTexture";
  2. /**
  3. * Define options used to create an internal texture
  4. */
  5. export interface InternalTextureCreationOptions {
  6. /**
  7. * Specifies if mipmaps must be created. If undefined, the value from generateMipMaps is taken instead
  8. */
  9. createMipMaps?: boolean;
  10. /**
  11. * Specifies if mipmaps must be generated
  12. */
  13. generateMipMaps?: boolean;
  14. /** Defines texture type (int by default) */
  15. type?: number;
  16. /** Defines sampling mode (trilinear by default) */
  17. samplingMode?: number;
  18. /** Defines format (RGBA by default) */
  19. format?: number;
  20. /** Defines sample count (1 by default) */
  21. samples?: number;
  22. /** Texture creation flags */
  23. creationFlags?: number;
  24. /** Creates the RTT in sRGB space */
  25. useSRGBBuffer?: boolean;
  26. /** Label of the texture (used for debugging only) */
  27. label?: string;
  28. }
  29. /**
  30. * Define options used to create a render target texture
  31. */
  32. export interface RenderTargetCreationOptions extends InternalTextureCreationOptions {
  33. /** Specifies whether or not a depth should be allocated in the texture (true by default) */
  34. generateDepthBuffer?: boolean;
  35. /** Specifies whether or not a stencil should be allocated in the texture (false by default)*/
  36. generateStencilBuffer?: boolean;
  37. /** Specifies that no color target should be bound to the render target (useful if you only want to write to the depth buffer, for eg) */
  38. noColorAttachment?: boolean;
  39. /** Specifies the internal texture to use directly instead of creating one (ignores `noColorAttachment` flag when set) **/
  40. colorAttachment?: InternalTexture;
  41. }
  42. /**
  43. * Define options used to create a depth texture
  44. */
  45. export interface DepthTextureCreationOptions {
  46. /** Specifies whether or not a stencil should be allocated in the texture */
  47. generateStencil?: boolean;
  48. /** Specifies whether or not bilinear filtering is enable on the texture */
  49. bilinearFiltering?: boolean;
  50. /** Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode */
  51. comparisonFunction?: number;
  52. /** Specifies if the created texture is a cube texture */
  53. isCube?: boolean;
  54. /** Specifies the sample count of the depth/stencil texture texture */
  55. samples?: number;
  56. /** Specifies the depth texture format to use */
  57. depthTextureFormat?: number;
  58. /** Label of the texture (used for debugging only) */
  59. label?: string;
  60. }
  61. /**
  62. * Type used to define a texture size (either with a number or with a rect width and height)
  63. */
  64. export type TextureSize = number | {
  65. width: number;
  66. height: number;
  67. depth?: number;
  68. layers?: number;
  69. };