-
Notifications
You must be signed in to change notification settings - Fork 754
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
Improve FPS in JEI by culling quads of BakedSimpleItem when in the GUI #3182
Conversation
public TextureAtlasSprite getParticleTexture() { return particle; } | ||
public ItemOverrideList getOverrides() { return overrides; } | ||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { | ||
if(side == null) return quads; |
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.
Really mezz, no braces? You're better than that ;P
} | ||
|
||
public BakedSimpleItem(List<net.minecraft.client.renderer.block.model.BakedQuad> quads, ImmutableMap<net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType, net.minecraftforge.common.model.TRSRTransformation> transforms, net.minecraft.client.renderer.block.model.IBakedModel base) { | ||
super(quads, transforms, base); | ||
private BakedSimpleItem(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, ItemOverrideList overrides, @Nullable IBakedModel unculledModel) { |
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.
Without looking at forge code.. when is this constructor ever called with a culled model? I couldn't find where it all comes together in the forge PR, kinda feels like something is missing.
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 code to do this is tricky af, you use the public constructor to create the unculled model.
That constructor calls the private one to create the culled model.
The two are referencing each other, and switch depending on if you are rendering in GUI or not.
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.
Yes, that's what I expected it to do. Apparently I overlooked that part in the constructor. Thanks
Fixes #3176
This basically implements the same culling logic found in fry's fix here:
MinecraftForge/MinecraftForge@f421379
The gist of it is that you can cull most of the quads off of items when they are in the gui because you can't see the sides.
Combined with the previous fixes (48b420b and #3180), this brings my FPS over 60 even when rendering every single Tinker's item at once in JEI!
Before this PR I got about 40 FPS, before all the fixes together I was getting like 9. Not bad :D