AbstractTexture.java

net.minecraft.client.renderer.texture.AbstractTexture

信息

  • 全限定名:net.minecraft.client.renderer.texture.AbstractTexture
  • 类型:public abstract class
  • 包:net.minecraft.client.renderer.texture
  • 源码路径:src/main/java/net/minecraft/client/renderer/texture/AbstractTexture.java
  • 起始行号:L14
  • 实现:AutoCloseable
  • 职责:

    TODO

字段/常量

  • texture

    • 类型: GpuTexture
    • 修饰符: protected
    • 源码定位: L15
    • 说明:

      TODO

  • textureView

    • 类型: GpuTextureView
    • 修饰符: protected
    • 源码定位: L16
    • 说明:

      TODO

  • sampler

    • 类型: GpuSampler
    • 修饰符: protected
    • 源码定位: L17
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public void close() @ L20

  • 方法名:close
  • 源码定位:L20
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

public GpuTexture getTexture() @ L33

  • 方法名:getTexture
  • 源码定位:L33
  • 返回类型:GpuTexture
  • 修饰符:public

参数:

说明:

TODO

public GpuTextureView getTextureView() @ L41

  • 方法名:getTextureView
  • 源码定位:L41
  • 返回类型:GpuTextureView
  • 修饰符:public

参数:

说明:

TODO

public GpuSampler getSampler() @ L49

  • 方法名:getSampler
  • 源码定位:L49
  • 返回类型:GpuSampler
  • 修饰符:public

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class AbstractTexture implements AutoCloseable {
    protected @Nullable GpuTexture texture;
    protected @Nullable GpuTextureView textureView;
    protected GpuSampler sampler = RenderSystem.getSamplerCache()
        .getSampler(AddressMode.REPEAT, AddressMode.REPEAT, FilterMode.NEAREST, FilterMode.LINEAR, false);
 
    @Override
    public void close() {
        if (this.texture != null) {
            this.texture.close();
            this.texture = null;
        }
 
        if (this.textureView != null) {
            this.textureView.close();
            this.textureView = null;
        }
    }
 
    public GpuTexture getTexture() {
        if (this.texture == null) {
            throw new IllegalStateException("Texture does not exist, can't get it before something initializes it");
        } else {
            return this.texture;
        }
    }
 
    public GpuTextureView getTextureView() {
        if (this.textureView == null) {
            throw new IllegalStateException("Texture view does not exist, can't get it before something initializes it");
        } else {
            return this.textureView;
        }
    }
 
    public GpuSampler getSampler() {
        return this.sampler;
    }
}

引用的其他类