Class SingleMeshVboRenderer

java.lang.Object
com.hbm_m.client.render.AbstractGpuMesh
com.hbm_m.client.render.SingleMeshVboRenderer
Direct Known Subclasses:
DoorVboRenderer

public abstract class SingleMeshVboRenderer extends AbstractGpuMesh
  • Field Details

    • MACHINE_PART_VERTEX_STRIDE_BYTES

      public static final int MACHINE_PART_VERTEX_STRIDE_BYTES
      Вершина instanced-мешей: pos(12) + normal(12) + uv(8) + int bone_id (4) = 36 байт. См. block_lit.vsh (USE_VERTEX_BONE_ID) и UBO костей в InstancedStaticPartRenderer.
      See Also:
    • useSlicedLight

      protected boolean useSlicedLight
  • Constructor Details

    • SingleMeshVboRenderer

      public SingleMeshVboRenderer()
  • Method Details

    • setFadeAlpha

      public static void setFadeAlpha(float alpha)
    • getFadeAlpha

      public static float getFadeAlpha()
    • setWorldMissileOverlayDraw

      public static void setWorldMissileOverlayDraw(boolean enabled)
    • isWorldMissileOverlayDraw

      public static boolean isWorldMissileOverlayDraw()
    • setEntityMissileDepthBias

      public static void setEntityMissileDepthBias(boolean enabled)
    • setUseSlicedLight

      public void setUseSlicedLight(boolean useSlicedLight)
    • buildVboData

      protected abstract SingleMeshVboRenderer.VboData buildVboData()
    • getQuadsForIrisPath

      protected List<net.minecraft.client.renderer.block.model.BakedQuad> getQuadsForIrisPath()
      Квады для Iris-совместимого пути (BufferBuilder + GameRenderer shader). Переопределяется в рендерерах, созданных через MeshRenderCache.
    • prepareBlockLitSamplers

      public static void prepareBlockLitSamplers(net.minecraft.client.renderer.ShaderInstance shader)
      Primes the shader's sampler map so that ShaderInstance.apply() binds the block atlas to Sampler0 and the dynamic lightmap to Sampler2 for the non-Iris block_lit pipeline. MUST be called before shader.apply().

      Why. ShaderInstance.apply() iterates samplers by JSON array index j, uploads Sampler"j" uniform = j, activates GL_TEXTURE0+j, and binds the texture from samplerMap. If samplerMap.get(name) is null, the entry is skipped — uniform stays at its link-time default of 0, so every sampler reads from GL_TEXTURE0 (the block atlas). That's the root cause of the "everything is solid white" regression: texture(Sampler2, lightmapUV) was reading the atlas at uv ≈ (0.97, 0.97) — a near-white atlas corner — instead of the lightmap.

      Vanilla's VertexBuffer._drawWithShader solves this by calling shader.setSampler("Sampler" + i, RenderSystem.getShaderTexture(i)) for i = 0..11 before apply(). We replicate that here because our render path goes straight through glDrawElements and bypasses VertexBuffer.

      For JSON samplers ["Sampler0", "Sampler2"]:

      • j=0: Sampler0 uniform = 0, atlas bound to GL_TEXTURE0
      • j=1: Sampler2 uniform = 1, lightmap bound to GL_TEXTURE1
      The shader's texture(Sampler2, lightmapUV) then correctly reads GL_TEXTURE1 (the lightmap) via the Sampler2 uniform value of 1. The name "Sampler2" is purely cosmetic — vanilla uses the same convention for rendertype_solid.
    • bindBlockLitSamplerTextures

      public static void bindBlockLitSamplerTextures(net.minecraft.client.renderer.ShaderInstance shader)
      Вызывать после ShaderInstance.apply() и перед любым instanced glDraw*. Пропуск = белые модели (см. блок «РЕГРЕССИЯ-СТОП» над prepareBlockLitSamplers(net.minecraft.client.renderer.ShaderInstance)).
    • initVbo

      protected void initVbo()
    • render

      public void render(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos)
    • render

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

      public void render(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)
    • cleanup

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