CompiledSectionMesh.java

net.minecraft.client.renderer.chunk.CompiledSectionMesh

信息

  • 全限定名:net.minecraft.client.renderer.chunk.CompiledSectionMesh
  • 类型:public class
  • 包:net.minecraft.client.renderer.chunk
  • 源码路径:src/main/java/net/minecraft/client/renderer/chunk/CompiledSectionMesh.java
  • 起始行号:L16
  • 实现:SectionMesh
  • 职责:

    TODO

字段/常量

  • UNCOMPILED

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

      TODO

  • EMPTY

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

      TODO

  • renderableBlockEntities

    • 类型: List<BlockEntity>
    • 修饰符: private final
    • 源码定位: L29
    • 说明:

      TODO

  • visibilitySet

    • 类型: VisibilitySet
    • 修饰符: private final
    • 源码定位: L30
    • 说明:

      TODO

  • transparencyState

    • 类型: MeshData.SortState
    • 修饰符: private final
    • 源码定位: L31
    • 说明:

      TODO

  • translucencyPointOfView

    • 类型: TranslucencyPointOfView
    • 修饰符: private
    • 源码定位: L32
    • 说明:

      TODO

  • draws

    • 类型: Map<ChunkSectionLayer,SectionMesh.SectionDraw>
    • 修饰符: private final
    • 源码定位: L33
    • 说明:

      TODO

  • vertexBufferUploaded

    • 类型: Map<ChunkSectionLayer,AtomicBoolean>
    • 修饰符: private final
    • 源码定位: L34
    • 说明:

      TODO

  • indexBufferUploaded

    • 类型: Map<ChunkSectionLayer,AtomicBoolean>
    • 修饰符: private final
    • 源码定位: L35
    • 说明:

      TODO

内部类/嵌套类型

构造器

public CompiledSectionMesh(TranslucencyPointOfView translucencyPointOfView, SectionCompiler.Results results) @ L37

  • 构造器名:CompiledSectionMesh
  • 源码定位:L37
  • 修饰符:public

参数:

  • translucencyPointOfView: TranslucencyPointOfView
  • results: SectionCompiler.Results

说明:

TODO

方法

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

public void setTranslucencyPointOfView(TranslucencyPointOfView translucencyPointOfView) @ L49

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

参数:

  • translucencyPointOfView: TranslucencyPointOfView

说明:

TODO

public boolean isDifferentPointOfView(TranslucencyPointOfView pointOfView) @ L53

  • 方法名:isDifferentPointOfView
  • 源码定位:L53
  • 返回类型:boolean
  • 修饰符:public

参数:

  • pointOfView: TranslucencyPointOfView

说明:

TODO

public boolean hasRenderableLayers() @ L58

  • 方法名:hasRenderableLayers
  • 源码定位:L58
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean isEmpty(ChunkSectionLayer layer) @ L63

  • 方法名:isEmpty
  • 源码定位:L63
  • 返回类型:boolean
  • 修饰符:public

参数:

  • layer: ChunkSectionLayer

说明:

TODO

public List<BlockEntity> getRenderableBlockEntities() @ L68

  • 方法名:getRenderableBlockEntities
  • 源码定位:L68
  • 返回类型:List
  • 修饰符:public

参数:

说明:

TODO

public boolean facesCanSeeEachother(Direction direction1, Direction direction2) @ L73

  • 方法名:facesCanSeeEachother
  • 源码定位:L73
  • 返回类型:boolean
  • 修饰符:public

参数:

  • direction1: Direction
  • direction2: Direction

说明:

TODO

public SectionMesh.SectionDraw getSectionDraw(ChunkSectionLayer layer) @ L78

  • 方法名:getSectionDraw
  • 源码定位:L78
  • 返回类型:SectionMesh.SectionDraw
  • 修饰符:public

参数:

  • layer: ChunkSectionLayer

说明:

TODO

public boolean isVertexBufferUploaded(ChunkSectionLayer layer) @ L83

  • 方法名:isVertexBufferUploaded
  • 源码定位:L83
  • 返回类型:boolean
  • 修饰符:public

参数:

  • layer: ChunkSectionLayer

说明:

TODO

public boolean isIndexBufferUploaded(ChunkSectionLayer layer) @ L87

  • 方法名:isIndexBufferUploaded
  • 源码定位:L87
  • 返回类型:boolean
  • 修饰符:public

参数:

  • layer: ChunkSectionLayer

说明:

TODO

public void setVertexBufferUploaded(ChunkSectionLayer layer) @ L91

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

参数:

  • layer: ChunkSectionLayer

说明:

TODO

public void setIndexBufferUploaded(ChunkSectionLayer layer) @ L95

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

参数:

  • layer: ChunkSectionLayer

说明:

TODO

public boolean hasTranslucentGeometry() @ L99

  • 方法名:hasTranslucentGeometry
  • 源码定位:L99
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public MeshData.SortState getTransparencyState() @ L104

  • 方法名:getTransparencyState
  • 源码定位:L104
  • 返回类型:MeshData.SortState
  • 修饰符:public

参数:

说明:

TODO

public void close() @ L108

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class CompiledSectionMesh implements SectionMesh {
    public static final SectionMesh UNCOMPILED = new SectionMesh() {
        @Override
        public boolean facesCanSeeEachother(Direction direction1, Direction direction2) {
            return false;
        }
    };
    public static final SectionMesh EMPTY = new SectionMesh() {
        @Override
        public boolean facesCanSeeEachother(Direction direction1, Direction direction2) {
            return true;
        }
    };
    private final List<BlockEntity> renderableBlockEntities;
    private final VisibilitySet visibilitySet;
    private final MeshData.@Nullable SortState transparencyState;
    private @Nullable TranslucencyPointOfView translucencyPointOfView;
    private final Map<ChunkSectionLayer, SectionMesh.SectionDraw> draws = new EnumMap<>(ChunkSectionLayer.class);
    private final Map<ChunkSectionLayer, AtomicBoolean> vertexBufferUploaded = Util.makeEnumMap(ChunkSectionLayer.class, layer -> new AtomicBoolean());
    private final Map<ChunkSectionLayer, AtomicBoolean> indexBufferUploaded = Util.makeEnumMap(ChunkSectionLayer.class, layer -> new AtomicBoolean());
 
    public CompiledSectionMesh(TranslucencyPointOfView translucencyPointOfView, SectionCompiler.Results results) {
        this.translucencyPointOfView = translucencyPointOfView;
        this.visibilitySet = results.visibilitySet;
        this.renderableBlockEntities = results.blockEntities;
        this.transparencyState = results.transparencyState;
        results.renderedLayers
            .forEach(
                (layer, mesh) -> this.draws
                    .put(layer, new SectionMesh.SectionDraw(mesh.drawState().indexCount(), mesh.drawState().indexType(), mesh.indexBuffer() != null))
            );
    }
 
    public void setTranslucencyPointOfView(TranslucencyPointOfView translucencyPointOfView) {
        this.translucencyPointOfView = translucencyPointOfView;
    }
 
    @Override
    public boolean isDifferentPointOfView(TranslucencyPointOfView pointOfView) {
        return !pointOfView.equals(this.translucencyPointOfView);
    }
 
    @Override
    public boolean hasRenderableLayers() {
        return !this.draws.isEmpty();
    }
 
    @Override
    public boolean isEmpty(ChunkSectionLayer layer) {
        return !this.draws.containsKey(layer);
    }
 
    @Override
    public List<BlockEntity> getRenderableBlockEntities() {
        return this.renderableBlockEntities;
    }
 
    @Override
    public boolean facesCanSeeEachother(Direction direction1, Direction direction2) {
        return this.visibilitySet.visibilityBetween(direction1, direction2);
    }
 
    @Override
    public SectionMesh.@Nullable SectionDraw getSectionDraw(ChunkSectionLayer layer) {
        return this.draws.get(layer);
    }
 
    public boolean isVertexBufferUploaded(ChunkSectionLayer layer) {
        return this.vertexBufferUploaded.get(layer).get();
    }
 
    public boolean isIndexBufferUploaded(ChunkSectionLayer layer) {
        return this.indexBufferUploaded.get(layer).get();
    }
 
    public void setVertexBufferUploaded(ChunkSectionLayer layer) {
        this.vertexBufferUploaded.get(layer).set(true);
    }
 
    public void setIndexBufferUploaded(ChunkSectionLayer layer) {
        this.indexBufferUploaded.get(layer).set(true);
    }
 
    @Override
    public boolean hasTranslucentGeometry() {
        return this.draws.containsKey(ChunkSectionLayer.TRANSLUCENT);
    }
 
    public MeshData.@Nullable SortState getTransparencyState() {
        return this.transparencyState;
    }
 
    @Override
    public void close() {
        this.draws.clear();
        this.vertexBufferUploaded.clear();
        this.indexBufferUploaded.clear();
    }
}

引用的其他类