textureSampler.d.ts 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import type { Nullable } from "../../types";
  2. /**
  3. * Class used to store a texture sampler data
  4. */
  5. export declare class TextureSampler {
  6. /**
  7. * Gets the sampling mode of the texture
  8. */
  9. samplingMode: number;
  10. /**
  11. * | Value | Type | Description |
  12. * | ----- | ------------------ | ----------- |
  13. * | 0 | CLAMP_ADDRESSMODE | |
  14. * | 1 | WRAP_ADDRESSMODE | |
  15. * | 2 | MIRROR_ADDRESSMODE | |
  16. */
  17. get wrapU(): Nullable<number>;
  18. set wrapU(value: Nullable<number>);
  19. /**
  20. * | Value | Type | Description |
  21. * | ----- | ------------------ | ----------- |
  22. * | 0 | CLAMP_ADDRESSMODE | |
  23. * | 1 | WRAP_ADDRESSMODE | |
  24. * | 2 | MIRROR_ADDRESSMODE | |
  25. */
  26. get wrapV(): Nullable<number>;
  27. set wrapV(value: Nullable<number>);
  28. /**
  29. * | Value | Type | Description |
  30. * | ----- | ------------------ | ----------- |
  31. * | 0 | CLAMP_ADDRESSMODE | |
  32. * | 1 | WRAP_ADDRESSMODE | |
  33. * | 2 | MIRROR_ADDRESSMODE | |
  34. */
  35. get wrapR(): Nullable<number>;
  36. set wrapR(value: Nullable<number>);
  37. /**
  38. * With compliant hardware and browser (supporting anisotropic filtering)
  39. * this defines the level of anisotropic filtering in the texture.
  40. * The higher the better but the slower.
  41. */
  42. get anisotropicFilteringLevel(): Nullable<number>;
  43. set anisotropicFilteringLevel(value: Nullable<number>);
  44. /**
  45. * Gets or sets the comparison function (Constants.LESS, Constants.EQUAL, etc). Set 0 to not use a comparison function
  46. */
  47. get comparisonFunction(): number;
  48. set comparisonFunction(value: number);
  49. private _useMipMaps;
  50. /**
  51. * Indicates to use the mip maps (if available on the texture).
  52. * Thanks to this flag, you can instruct the sampler to not sample the mipmaps even if they exist (and if the sampling mode is set to a value that normally samples the mipmaps!)
  53. */
  54. get useMipMaps(): boolean;
  55. set useMipMaps(value: boolean);
  56. /** @internal */
  57. _cachedWrapU: Nullable<number>;
  58. /** @internal */
  59. _cachedWrapV: Nullable<number>;
  60. /** @internal */
  61. _cachedWrapR: Nullable<number>;
  62. /** @internal */
  63. _cachedAnisotropicFilteringLevel: Nullable<number>;
  64. /** @internal */
  65. _comparisonFunction: number;
  66. /**
  67. * Used for debugging purpose only
  68. */
  69. label?: string;
  70. /**
  71. * Creates a Sampler instance
  72. */
  73. constructor();
  74. /**
  75. * Sets all the parameters of the sampler
  76. * @param wrapU u address mode (default: TEXTURE_WRAP_ADDRESSMODE)
  77. * @param wrapV v address mode (default: TEXTURE_WRAP_ADDRESSMODE)
  78. * @param wrapR r address mode (default: TEXTURE_WRAP_ADDRESSMODE)
  79. * @param anisotropicFilteringLevel anisotropic level (default: 1)
  80. * @param samplingMode sampling mode (default: Constants.TEXTURE_BILINEAR_SAMPLINGMODE)
  81. * @param comparisonFunction comparison function (default: 0 - no comparison function)
  82. * @returns the current sampler instance
  83. */
  84. setParameters(wrapU?: number, wrapV?: number, wrapR?: number, anisotropicFilteringLevel?: number, samplingMode?: number, comparisonFunction?: number): TextureSampler;
  85. /**
  86. * Compares this sampler with another one
  87. * @param other sampler to compare with
  88. * @returns true if the samplers have the same parametres, else false
  89. */
  90. compareSampler(other: TextureSampler): boolean;
  91. }