Class InstancedStaticPartRenderer

java.lang.Object
com.hbm_m.client.render.AbstractGpuMesh
com.hbm_m.client.render.InstancedStaticPartRenderer
All Implemented Interfaces:
IrisCompanionMeshRenderer, VanillaInstancedMeshRenderer

public class InstancedStaticPartRenderer extends AbstractGpuMesh implements VanillaInstancedMeshRenderer, IrisCompanionMeshRenderer
Instanced Renderer для статических частей (Base/Frame). Без шейдеров рендерит все машины одного типа одним glDrawElementsInstanced. Под Iris/Oculus переключается на per-machine draw через ExtendedShader + companion VBO с IrisVertexFormats.ENTITY layout, что даёт корректный G-buffer / shadow pass / pack uniforms.

Flush logic is delegated to VanillaInstancedBatchRenderer (vanilla path) and IrisInstancedBatchRenderer (Iris/Oculus path). GL compatibility helpers live in InstancedGlCompat.

  • Constructor Details

  • Method Details

    • drainOverflowAddCount

      public static int drainOverflowAddCount()
      Diagnostics: consumed by InstancedRenderStats.
    • getQuadsForIrisPath

      protected List<net.minecraft.client.renderer.block.model.BakedQuad> getQuadsForIrisPath()
    • renderSingle

      public void renderSingle(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    • renderSingle

      public void renderSingle(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.client.renderer.MultiBufferSource bufferSource)
      Description copied from interface: VanillaInstancedMeshRenderer
      Single-machine immediate draw on the vanilla instanced shader path.

      Source: InstancedStaticPartRenderer#renderSingle(PoseStack, int, BlockPos, BlockEntity, MultiBufferSource) — specifically the --- VANILLA VBO PATH --- branch after the isExternalShaderActive() early-out.

      Specified by:
      renderSingle in interface VanillaInstancedMeshRenderer
    • addInstance

      public void addInstance(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
    • addInstance

      public void addInstance(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.client.renderer.MultiBufferSource bufferSource)
      Description copied from interface: VanillaInstancedMeshRenderer
      Enqueue one instance into the per-frame batch buffer for the next VanillaInstancedMeshRenderer.flush(Matrix4f).

      Source: InstancedStaticPartRenderer#addInstance(PoseStack, int, BlockPos, BlockEntity, MultiBufferSource) — the vanilla accumulation portion (everything below the Iris/shadow-pass early-outs, including the LightSampleCache 8/16-corner sampling and the float-buffer record write at the bottom).

      Specified by:
      addInstance in interface VanillaInstancedMeshRenderer
    • addInstance

      public void addInstance(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.client.renderer.MultiBufferSource bufferSource, @Nullable float[] sharedCornerUV8)
    • addInstanceGpuBones

      public void addInstanceGpuBones(com.mojang.blaze3d.vertex.PoseStack baseBlockPose, org.joml.Matrix4f partLocalToBlock, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.client.renderer.MultiBufferSource bufferSource)
    • addInstanceGpuBones

      public void addInstanceGpuBones(com.mojang.blaze3d.vertex.PoseStack baseBlockPose, org.joml.Matrix4f partLocalToBlock, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, @Nullable net.minecraft.client.renderer.MultiBufferSource bufferSource, @Nullable float[] sharedCornerUV8)
    • usesGpuPartBonePath

      public boolean usesGpuPartBonePath()
    • flush

      public void flush()
      Description copied from interface: VanillaInstancedMeshRenderer
      Convenience entry that pulls the projection from RenderSystem. Source: InstancedStaticPartRenderer#flush().
      Specified by:
      flush in interface VanillaInstancedMeshRenderer
    • flush

      public void flush(net.minecraftforge.client.event.RenderLevelStageEvent event)
    • flush

      public void flush(org.joml.Matrix4f projectionMatrix)
      Вызывается из InstancedRenderFrame.presentAfterBlockEntities(org.joml.Matrix4f, net.minecraft.world.phys.Vec3) в том же кадре, что addInstance — не откладывать flush на конец уровня.
      Specified by:
      flush in interface VanillaInstancedMeshRenderer
    • flushBatchIris

      public void flushBatchIris(org.joml.Matrix4f projectionMatrix)
      Description copied from interface: IrisCompanionMeshRenderer
      Iris-compatible batch flush: a sequence of per-machine draws through the ExtendedShader, with framebuffer/CustomUniforms hoisted outside the loop and only ModelViewMat / iris_* derived uniforms mutated per instance. Renders both main and shadow passes so machines correctly cast shadows under shader packs.

      Source: InstancedStaticPartRenderer#flushBatchIris(Matrix4f).

      Specified by:
      flushBatchIris in interface IrisCompanionMeshRenderer
    • drawSingleWithIrisExtended

      public boolean drawSingleWithIrisExtended(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
      Description copied from interface: IrisCompanionMeshRenderer
      Per-machine draw through the Iris ExtendedShader obtained from ShaderMap. Used both as the main entry for single-instance Iris draws and as the shadow-pass bypass invoked from addInstance when ShaderCompatibilityDetector .isRenderingShadowPass() returns true.

      Source: InstancedStaticPartRenderer#drawSingleWithIrisExtended( PoseStack, int, BlockPos, BlockEntity).

      Specified by:
      drawSingleWithIrisExtended in interface IrisCompanionMeshRenderer
      Returns:
      true if the draw was performed (companion mesh + shader resolved); false to signal the caller should fall through to the classic putBulkData path.
    • isInitialized

      public boolean isInitialized()
      Specified by:
      isInitialized in interface VanillaInstancedMeshRenderer
      Returns:
      whether the underlying VAO/VBO/EBO triple was successfully created and the renderer is ready to draw. Source: InstancedStaticPartRenderer#isInitialized().
    • getInstanceCount

      public int getInstanceCount()
      Specified by:
      getInstanceCount in interface VanillaInstancedMeshRenderer
      Returns:
      number of instances currently accumulated in the batch buffer. Source: InstancedStaticPartRenderer#getInstanceCount().
    • setMdiTraceTag

      public void setMdiTraceTag(@Nullable String tag)
    • getMdiTraceTag

      @Nullable public String getMdiTraceTag()
    • cleanup

      public void cleanup()
      Description copied from class: AbstractGpuMesh
      Освобождение GL-ресурсов (VAO/VBO/EBO) на render-треде. Конкретные рендереры должны вызывать этот метод из своего cleanup().
      Specified by:
      cleanup in interface VanillaInstancedMeshRenderer
      Overrides:
      cleanup in class AbstractGpuMesh