-
Notifications
You must be signed in to change notification settings - Fork 205
Replace ImmediateWorldSceneRenderer with VBOWorldSceneRenderer
#2849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this not also call GLSM lighting like the original method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a spot where this should be cleared? Besides when recalculating the TEs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a call to Block.isAir() instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.