WebGLCapabilities.js 628 B

123456789101112131415161718192021222324252627282930313233343536
  1. class WebGLCapabilities {
  2. constructor( backend ) {
  3. this.backend = backend;
  4. this.maxAnisotropy = null;
  5. }
  6. getMaxAnisotropy() {
  7. if ( this.maxAnisotropy !== null ) return this.maxAnisotropy;
  8. const gl = this.backend.gl;
  9. const extensions = this.backend.extensions;
  10. if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
  11. const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
  12. this.maxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );
  13. } else {
  14. this.maxAnisotropy = 0;
  15. }
  16. return this.maxAnisotropy;
  17. }
  18. }
  19. export default WebGLCapabilities;