Class InstancedStaticPartRenderer
- All Implemented Interfaces:
IrisCompanionMeshRenderer,VanillaInstancedMeshRenderer
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.
-
Field Summary
Fields inherited from class com.hbm_m.client.render.AbstractGpuMesh
eboId, indexCount, initFailed, initialized, objBbox, vaoId, vboId -
Constructor Summary
ConstructorsConstructorDescriptionInstancedStaticPartRenderer(SingleMeshVboRenderer.VboData data, List<net.minecraft.client.renderer.block.model.BakedQuad> quadsForIris) InstancedStaticPartRenderer(SingleMeshVboRenderer.VboData data, List<net.minecraft.client.renderer.block.model.BakedQuad> quadsForIris, boolean useSlicedLight) InstancedStaticPartRenderer(SingleMeshVboRenderer.VboData data, List<net.minecraft.client.renderer.block.model.BakedQuad> quadsForIris, boolean useSlicedLight, boolean storesPerInstancePartBone) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInstance(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity) voidaddInstance(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) Enqueue one instance into the per-frame batch buffer for the nextVanillaInstancedMeshRenderer.flush(Matrix4f).voidaddInstance(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, float[] sharedCornerUV8) LikeaddInstance(PoseStack, int, BlockPos, BlockEntity, MultiBufferSource)but reusessharedCornerUV8(16 floats fromLightSampleCache.getOrSample8(net.minecraft.world.level.block.entity.BlockEntity, long, float[], net.minecraft.core.BlockPos, org.joml.Matrix4f, int, float[])) for all parts of one machine in the same frame — avoids repeated spatial sampling at farm scale.voidaddInstanceGpuBones(com.mojang.blaze3d.vertex.PoseStack baseBlockPose, org.joml.Matrix4f partLocalToBlock, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.client.renderer.MultiBufferSource bufferSource) voidaddInstanceGpuBones(com.mojang.blaze3d.vertex.PoseStack baseBlockPose, org.joml.Matrix4f partLocalToBlock, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.client.renderer.MultiBufferSource bufferSource, float[] sharedCornerUV8) voidcleanup()Освобождение GL-ресурсов (VAO/VBO/EBO) на render-треде.static intDiagnostics: consumed byInstancedRenderStats.booleandrawSingleWithIrisExtended(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity) Per-machine draw through the IrisExtendedShaderobtained fromShaderMap.voidflush()Convenience entry that pulls the projection fromRenderSystem.voidflush(net.minecraftforge.client.event.RenderLevelStageEvent event) voidflush(org.joml.Matrix4f projectionMatrix) Вызывается изInstancedRenderFrame.presentAfterBlockEntities(org.joml.Matrix4f, net.minecraft.world.phys.Vec3)в том же кадре, что addInstance — не откладывать flush на конец уровня.voidflushBatchIris(org.joml.Matrix4f projectionMatrix) Iris-compatible batch flush: a sequence of per-machine draws through theExtendedShader, with framebuffer/CustomUniforms hoisted outside the loop and onlyModelViewMat/iris_*derived uniforms mutated per instance.intprotected List<net.minecraft.client.renderer.block.model.BakedQuad>booleanvoidrenderSingle(com.mojang.blaze3d.vertex.PoseStack poseStack, int packedLight, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.entity.BlockEntity blockEntity) voidrenderSingle(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) Single-machine immediate draw on the vanilla instanced shader path.voidsetMdiTraceTag(String tag) booleanMethods inherited from class com.hbm_m.client.render.AbstractGpuMesh
getObjBbox, setObjBboxFrom
-
Constructor Details
-
InstancedStaticPartRenderer
-
InstancedStaticPartRenderer
public InstancedStaticPartRenderer(SingleMeshVboRenderer.VboData data, List<net.minecraft.client.renderer.block.model.BakedQuad> quadsForIris) -
InstancedStaticPartRenderer
public InstancedStaticPartRenderer(SingleMeshVboRenderer.VboData data, List<net.minecraft.client.renderer.block.model.BakedQuad> quadsForIris, boolean useSlicedLight) -
InstancedStaticPartRenderer
public InstancedStaticPartRenderer(SingleMeshVboRenderer.VboData data, List<net.minecraft.client.renderer.block.model.BakedQuad> quadsForIris, boolean useSlicedLight, boolean storesPerInstancePartBone) - Parameters:
storesPerInstancePartBone- assembler arms:addInstanceGpuBones(com.mojang.blaze3d.vertex.PoseStack, org.joml.Matrix4f, int, net.minecraft.core.BlockPos, net.minecraft.world.level.block.entity.BlockEntity, net.minecraft.client.renderer.MultiBufferSource)(no MDI atlas).
-
-
Method Details
-
drainOverflowAddCount
public static int drainOverflowAddCount()Diagnostics: consumed byInstancedRenderStats. -
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:VanillaInstancedMeshRendererSingle-machine immediate draw on the vanilla instanced shader path.Source:
InstancedStaticPartRenderer#renderSingle(PoseStack, int, BlockPos, BlockEntity, MultiBufferSource)— specifically the--- VANILLA VBO PATH ---branch after theisExternalShaderActive()early-out.- Specified by:
renderSinglein interfaceVanillaInstancedMeshRenderer
-
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:VanillaInstancedMeshRendererEnqueue one instance into the per-frame batch buffer for the nextVanillaInstancedMeshRenderer.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:
addInstancein interfaceVanillaInstancedMeshRenderer
-
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) LikeaddInstance(PoseStack, int, BlockPos, BlockEntity, MultiBufferSource)but reusessharedCornerUV8(16 floats fromLightSampleCache.getOrSample8(net.minecraft.world.level.block.entity.BlockEntity, long, float[], net.minecraft.core.BlockPos, org.joml.Matrix4f, int, float[])) for all parts of one machine in the same frame — avoids repeated spatial sampling at farm scale. -
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:VanillaInstancedMeshRendererConvenience entry that pulls the projection fromRenderSystem. Source:InstancedStaticPartRenderer#flush().- Specified by:
flushin interfaceVanillaInstancedMeshRenderer
-
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:
flushin interfaceVanillaInstancedMeshRenderer
-
flushBatchIris
public void flushBatchIris(org.joml.Matrix4f projectionMatrix) Description copied from interface:IrisCompanionMeshRendererIris-compatible batch flush: a sequence of per-machine draws through theExtendedShader, with framebuffer/CustomUniforms hoisted outside the loop and onlyModelViewMat/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:
flushBatchIrisin interfaceIrisCompanionMeshRenderer
-
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:IrisCompanionMeshRendererPer-machine draw through the IrisExtendedShaderobtained fromShaderMap. Used both as the main entry for single-instance Iris draws and as the shadow-pass bypass invoked fromaddInstancewhenShaderCompatibilityDetector .isRenderingShadowPass()returns true.Source:
InstancedStaticPartRenderer#drawSingleWithIrisExtended( PoseStack, int, BlockPos, BlockEntity).- Specified by:
drawSingleWithIrisExtendedin interfaceIrisCompanionMeshRenderer- Returns:
trueif the draw was performed (companion mesh + shader resolved);falseto signal the caller should fall through to the classicputBulkDatapath.
-
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfaceVanillaInstancedMeshRenderer- 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:
getInstanceCountin interfaceVanillaInstancedMeshRenderer- Returns:
- number of instances currently accumulated in the batch buffer.
Source:
InstancedStaticPartRenderer#getInstanceCount().
-
setMdiTraceTag
-
getMdiTraceTag
-
cleanup
public void cleanup()Description copied from class:AbstractGpuMeshОсвобождение GL-ресурсов (VAO/VBO/EBO) на render-треде. Конкретные рендереры должны вызывать этот метод из своего cleanup().- Specified by:
cleanupin interfaceVanillaInstancedMeshRenderer- Overrides:
cleanupin classAbstractGpuMesh
-