Replace ImmediateWorldSceneRenderer with VBOWorldSceneRenderer#2849
Replace ImmediateWorldSceneRenderer with VBOWorldSceneRenderer#2849MCTian-mi wants to merge 7 commits intoGregTechCEu:masterfrom
ImmediateWorldSceneRenderer with VBOWorldSceneRenderer#2849Conversation
ImmediateWorldSceneRenderer with VBOWorldSceneRenderer
|
Another thing left to be optimized is to cache the |
| } | ||
|
|
||
| protected void renderTileEntities() { | ||
| RenderHelper.enableStandardItemLighting(); |
There was a problem hiding this comment.
Why does this not also call GLSM lighting like the original method?
There was a problem hiding this comment.
the GlStateManager#enableLighting() is already called in RenderHelper#enableStandardItemLighting() so ig it's fine? Other GLSM calls are called before this method got invoked
| if (tile != null && (!(tile instanceof IGregTechTileEntity gtte) || | ||
| // Put MTEs only when it has FastRenderer | ||
| gtte.getMetaTileEntity() instanceof IFastRenderMetaTileEntity)) { | ||
| TILE_ENTITIES.put(pos, tile); |
There was a problem hiding this comment.
Is there a spot where this should be cleared? Besides when recalculating the TEs?
There was a problem hiding this comment.
I don't know, actually. The renderer itself won't get GC'ed when used in JEI plugin, neither did I found a proper place to call clear on this, so I just made this cleared where renderedBlocks got cleared.
I think it might be ok since there's < 1 elements in the map by average?
Or should I use a Cache so it got automatically invalidated?
| for (BlockPos pos : renderedBlocks) { | ||
| IBlockState state = world.getBlockState(pos); | ||
| Block block = state.getBlock(); | ||
| if (block == Blocks.AIR) continue; |
There was a problem hiding this comment.
Shouldn't this be a call to Block.isAir() instead?
There was a problem hiding this comment.
It was == before, and I think it's because that a custom block that has block#isAir to return true could still have custom textures.
Generally I think this won't be that much of a difference here. But I can change it to smth like world#isAirBlock.
| } | ||
|
|
||
| TrackedDummyWorld world = new TrackedDummyWorld(); | ||
| ImmediateWorldSceneRenderer worldSceneRenderer = new ImmediateWorldSceneRenderer(world); |
There was a problem hiding this comment.
Since this was the only place where ImmediateWorldSceneRenderer was used, should we go ahead and fold the methods into VBOWorldSceneRenderer and delete the class?
There was a problem hiding this comment.
It was used in terminal I think, but yeah ig we could safely delete this since mui has its own world renderer impl that is exactly the same as ImmediateWorldSceneRenderer (at least the last time I checked)
What
Added a
VBOWorldSceneRenderer, extendingImmediateWorldSceneRenderer, which use cached VBO for rendering blocks in the preview, and significantly reduces render lag.This is the first time I do rendering stuff so expect things to break.