Class SingleMeshVboRenderer
- Direct Known Subclasses:
DoorVboRenderer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intВершина instanced-мешей: pos(12) + normal(12) + uv(8) + intbone_id(4) = 36 байт.protected booleanFields inherited from class com.hbm_m.client.render.AbstractGpuMesh
eboId, indexCount, initFailed, initialized, objBbox, vaoId, vboId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindBlockLitSamplerTextures(net.minecraft.client.renderer.ShaderInstance shader) Вызывать послеShaderInstance.apply()и перед любым instanced glDraw*.protected abstract SingleMeshVboRenderer.VboDatavoidcleanup()Освобождение GL-ресурсов (VAO/VBO/EBO) на render-треде.static floatprotected List<net.minecraft.client.renderer.block.model.BakedQuad>Квады для Iris-совместимого пути (BufferBuilder + GameRenderer shader).protected voidinitVbo()static booleanstatic voidprepareBlockLitSamplers(net.minecraft.client.renderer.ShaderInstance shader) Primes the shader's sampler map so thatShaderInstance.apply()binds the block atlas toSampler0and the dynamic lightmap toSampler2for the non-Irisblock_litpipeline.voidrender(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos) voidrender(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity) voidrender(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.client.renderer.MultiBufferSource bufferSource) static voidsetEntityMissileDepthBias(boolean enabled) static voidsetFadeAlpha(float alpha) voidsetUseSlicedLight(boolean useSlicedLight) static voidsetWorldMissileOverlayDraw(boolean enabled) Methods inherited from class com.hbm_m.client.render.AbstractGpuMesh
getObjBbox, setObjBboxFrom
-
Field Details
-
MACHINE_PART_VERTEX_STRIDE_BYTES
public static final int MACHINE_PART_VERTEX_STRIDE_BYTESВершина instanced-мешей: pos(12) + normal(12) + uv(8) + intbone_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
-
getQuadsForIrisPath
Квады для Iris-совместимого пути (BufferBuilder + GameRenderer shader). Переопределяется в рендерерах, созданных через MeshRenderCache. -
prepareBlockLitSamplers
public static void prepareBlockLitSamplers(net.minecraft.client.renderer.ShaderInstance shader) Primes the shader's sampler map so thatShaderInstance.apply()binds the block atlas toSampler0and the dynamic lightmap toSampler2for the non-Irisblock_litpipeline. MUST be called beforeshader.apply().Why.
ShaderInstance.apply()iterates samplers by JSON array indexj, uploadsSampler"j"uniform =j, activatesGL_TEXTURE0+j, and binds the texture fromsamplerMap. IfsamplerMap.get(name)isnull, the entry is skipped — uniform stays at its link-time default of 0, so every sampler reads fromGL_TEXTURE0(the block atlas). That's the root cause of the "everything is solid white" regression:texture(Sampler2, lightmapUV)was reading the atlas atuv ≈ (0.97, 0.97)— a near-white atlas corner — instead of the lightmap.Vanilla's
VertexBuffer._drawWithShadersolves this by callingshader.setSampler("Sampler" + i, RenderSystem.getShaderTexture(i))fori = 0..11beforeapply(). We replicate that here because our render path goes straight throughglDrawElementsand bypassesVertexBuffer.For JSON samplers
["Sampler0", "Sampler2"]:j=0:Sampler0uniform = 0, atlas bound toGL_TEXTURE0j=1:Sampler2uniform = 1, lightmap bound toGL_TEXTURE1
texture(Sampler2, lightmapUV)then correctly readsGL_TEXTURE1(the lightmap) via theSampler2uniform value of 1. The name "Sampler2" is purely cosmetic — vanilla uses the same convention forrendertype_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:
cleanupin classAbstractGpuMesh
-