TextureMinificationFilter.js 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import freezeObject from '../Core/freezeObject.js';
  2. import WebGLConstants from '../Core/WebGLConstants.js';
  3. /**
  4. * Enumerates all possible filters used when minifying WebGL textures.
  5. *
  6. * @exports TextureMinificationFilter
  7. *
  8. * @see TextureMagnificationFilter
  9. */
  10. var TextureMinificationFilter = {
  11. /**
  12. * Samples the texture by returning the closest pixel.
  13. *
  14. * @type {Number}
  15. * @constant
  16. */
  17. NEAREST : WebGLConstants.NEAREST,
  18. /**
  19. * Samples the texture through bi-linear interpolation of the four nearest pixels. This produces smoother results than <code>NEAREST</code> filtering.
  20. *
  21. * @type {Number}
  22. * @constant
  23. */
  24. LINEAR : WebGLConstants.LINEAR,
  25. /**
  26. * Selects the nearest mip level and applies nearest sampling within that level.
  27. * <p>
  28. * Requires that the texture has a mipmap. The mip level is chosen by the view angle and screen-space size of the texture.
  29. * </p>
  30. *
  31. * @type {Number}
  32. * @constant
  33. */
  34. NEAREST_MIPMAP_NEAREST : WebGLConstants.NEAREST_MIPMAP_NEAREST,
  35. /**
  36. * Selects the nearest mip level and applies linear sampling within that level.
  37. * <p>
  38. * Requires that the texture has a mipmap. The mip level is chosen by the view angle and screen-space size of the texture.
  39. * </p>
  40. *
  41. * @type {Number}
  42. * @constant
  43. */
  44. LINEAR_MIPMAP_NEAREST : WebGLConstants.LINEAR_MIPMAP_NEAREST,
  45. /**
  46. * Read texture values with nearest sampling from two adjacent mip levels and linearly interpolate the results.
  47. * <p>
  48. * This option provides a good balance of visual quality and speed when sampling from a mipmapped texture.
  49. * </p>
  50. * <p>
  51. * Requires that the texture has a mipmap. The mip level is chosen by the view angle and screen-space size of the texture.
  52. * </p>
  53. *
  54. * @type {Number}
  55. * @constant
  56. */
  57. NEAREST_MIPMAP_LINEAR : WebGLConstants.NEAREST_MIPMAP_LINEAR,
  58. /**
  59. * Read texture values with linear sampling from two adjacent mip levels and linearly interpolate the results.
  60. * <p>
  61. * This option provides a good balance of visual quality and speed when sampling from a mipmapped texture.
  62. * </p>
  63. * <p>
  64. * Requires that the texture has a mipmap. The mip level is chosen by the view angle and screen-space size of the texture.
  65. * </p>
  66. * @type {Number}
  67. * @constant
  68. */
  69. LINEAR_MIPMAP_LINEAR : WebGLConstants.LINEAR_MIPMAP_LINEAR,
  70. /**
  71. * Validates the given <code>textureMinificationFilter</code> with respect to the possible enum values.
  72. *
  73. * @private
  74. *
  75. * @param textureMinificationFilter
  76. * @returns {Boolean} <code>true</code> if <code>textureMinificationFilter</code> is valid.
  77. */
  78. validate : function(textureMinificationFilter) {
  79. return ((textureMinificationFilter === TextureMinificationFilter.NEAREST) ||
  80. (textureMinificationFilter === TextureMinificationFilter.LINEAR) ||
  81. (textureMinificationFilter === TextureMinificationFilter.NEAREST_MIPMAP_NEAREST) ||
  82. (textureMinificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_NEAREST) ||
  83. (textureMinificationFilter === TextureMinificationFilter.NEAREST_MIPMAP_LINEAR) ||
  84. (textureMinificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_LINEAR));
  85. }
  86. };
  87. export default freezeObject(TextureMinificationFilter);