GlShaderModule.java

com.mojang.blaze3d.opengl.GlShaderModule

信息

  • 全限定名:com.mojang.blaze3d.opengl.GlShaderModule
  • 类型:public class
  • 包:com.mojang.blaze3d.opengl
  • 源码路径:src/main/java/com/mojang/blaze3d/opengl/GlShaderModule.java
  • 起始行号:L10
  • 实现:AutoCloseable
  • 职责:

    TODO

字段/常量

  • NOT_ALLOCATED

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L11
    • 说明:

      TODO

  • INVALID_SHADER

    • 类型: GlShaderModule
    • 修饰符: public static final
    • 源码定位: L12
    • 说明:

      TODO

  • id

    • 类型: Identifier
    • 修饰符: private final
    • 源码定位: L13
    • 说明:

      TODO

  • shaderId

    • 类型: int
    • 修饰符: private
    • 源码定位: L14
    • 说明:

      TODO

  • type

    • 类型: ShaderType
    • 修饰符: private final
    • 源码定位: L15
    • 说明:

      TODO

内部类/嵌套类型

构造器

public GlShaderModule(int shaderId, Identifier id, ShaderType type) @ L17

  • 构造器名:GlShaderModule
  • 源码定位:L17
  • 修饰符:public

参数:

  • shaderId: int
  • id: Identifier
  • type: ShaderType

说明:

TODO

方法

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

public void close() @ L23

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

参数:

说明:

TODO

public Identifier getId() @ L34

  • 方法名:getId
  • 源码定位:L34
  • 返回类型:Identifier
  • 修饰符:public

参数:

说明:

TODO

public int getShaderId() @ L38

  • 方法名:getShaderId
  • 源码定位:L38
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public String getDebugLabel() @ L42

  • 方法名:getDebugLabel
  • 源码定位:L42
  • 返回类型:String
  • 修饰符:public

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GlShaderModule implements AutoCloseable {
    private static final int NOT_ALLOCATED = -1;
    public static final GlShaderModule INVALID_SHADER = new GlShaderModule(-1, Identifier.withDefaultNamespace("invalid"), ShaderType.VERTEX);
    private final Identifier id;
    private int shaderId;
    private final ShaderType type;
 
    public GlShaderModule(int shaderId, Identifier id, ShaderType type) {
        this.id = id;
        this.shaderId = shaderId;
        this.type = type;
    }
 
    @Override
    public void close() {
        if (this.shaderId == -1) {
            throw new IllegalStateException("Already closed");
        } else {
            RenderSystem.assertOnRenderThread();
            GlStateManager.glDeleteShader(this.shaderId);
            this.shaderId = -1;
        }
    }
 
    public Identifier getId() {
        return this.id;
    }
 
    public int getShaderId() {
        return this.shaderId;
    }
 
    public String getDebugLabel() {
        return this.type.idConverter().idToFile(this.id).toString();
    }
}

引用的其他类

  • GlStateManager

    • 引用位置: 方法调用
    • 关联成员: GlStateManager.glDeleteShader()
  • ShaderType

    • 引用位置: 参数/字段
  • RenderSystem

    • 引用位置: 方法调用
    • 关联成员: RenderSystem.assertOnRenderThread()
  • Identifier

    • 引用位置: 参数/字段/方法调用/返回值
    • 关联成员: Identifier.withDefaultNamespace()