Skip to content
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

Small Optimizations regarding entity rendering #624

Open
Speiger opened this issue Oct 2, 2023 · 0 comments
Open

Small Optimizations regarding entity rendering #624

Speiger opened this issue Oct 2, 2023 · 0 comments

Comments

@Speiger
Copy link
Contributor

Speiger commented Oct 2, 2023

o/
I know this is more of a nitpick but you can optimize entity rendering.

matrixStack.mulPose(Vector3f.ZP.rotationDegrees(180));

Because there is useless multiplications in there, since neither JOML or minecraft decrease matrix operations if they do nothing.

        matrixStack.mulPose(Vector3f.ZP.rotationDegrees(180));
        matrixStack.mulPose(Vector3f.YP.rotationDegrees(135)); //Useless
        net.minecraft.client.renderer.RenderHelper.turnBackOn(); //Just sets a shader texture/flag, doesn't use the Matrix and even if the matrix wasn't applied yet.
        matrixStack.mulPose(Vector3f.YP.rotationDegrees(-135)); //Useless since it just negates the previous operation with 0 uses actually.
        matrixStack.mulPose(Vector3f.YP.rotationDegrees(rot));
        matrixStack.mulPose(Vector3f.XP.rotationDegrees(0)); //WHY? Debug stuff left?

It is just a tiny optimization, but it gets rid of expensive calculations that lower end hardware would benefit A LOT of.

Edit: This is even in newer mc versions.
Edit: Also i found out that if you Lighting.setupForFlatItems() entities look better, especially if rotating. Though you have to try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant