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

Improve the Quantum Storage Renderer #2318

Merged
merged 21 commits into from
Apr 4, 2024

Conversation

ghzdude
Copy link
Contributor

@ghzdude ghzdude commented Dec 22, 2023

What

This pr improves the quantum storage render by rendering the minimum amount of faces needed (15). Previously, it would render 31 faces.

also improves quantum tank rendering fluid contents by only rendering the two needed faces instead of all six

Implementation Details

idk why a foreach() was used for the boxFacingMap
also previously it was facing, boxFacingMap.get(box) in renderFace(), which looked backwards to me
store the TextTexture as a static final variable instead of instantiating it every frame

Outcome

more fps

Potential Compatibility Issues

none

@ghzdude ghzdude added the type: refactor Suggestion to refactor a section of code label Dec 22, 2023
@ghzdude ghzdude requested a review from a team as a code owner December 22, 2023 07:43
@ghzdude
Copy link
Contributor Author

ghzdude commented Jan 1, 2024

(yes this is copied from the discord)

Here's a sparkc profile without the renderer changes (in the quantum controller pr brance), and here's with the render changes. I'm not sure how accurate these are, but they were profiled for 300s while I'm looking at ~100 quantum storage chests and not moving.

2nd sparkc profile without the changes, and another with the changes

@ghzdude
Copy link
Contributor Author

ghzdude commented Jan 2, 2024

(copied from discord)

New profile with the text rendering removed + previous changes, and without any changes on master (with command /sparkc profiler --timeout 300)

@ghzdude
Copy link
Contributor Author

ghzdude commented Jan 20, 2024

New profiles:
with changes
without changes

round 2
https://spark.lucko.me/94aexdIT4O - with changes
https://spark.lucko.me/qr9uKAaaJP - without changes
https://spark.lucko.me/LrC9Trihde - with fancy config set to false (disable fast TESR render for chests/tanks)

https://spark.lucko.me/HDGZWCFdtV - using mc's font renderer directly instead of TextTexture

https://spark.lucko.me/KG13MeawaE - not rendering if the player is too far

@ghzdude ghzdude force-pushed the gh-quantum-render-improvements branch from 52c6c72 to 0f5f660 Compare March 3, 2024 03:33
Comment on lines 72 to 74
for (EnumFacing facing : EnumFacing.VALUES) {
for (EnumFacing boxFace : EnumFacing.VALUES) {
// do not render the box when "facing" is "frontFacing", otherwise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand this part, we are already looping through EnumFacing, why do we need to start another loop through EnumFacing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the outer loop is for the sides of the machine, the inner loop is for rendering the boxes for the inside and outside of the chest. essentially rendering certain faces of a box for each side.

src/main/java/gregtech/api/gui/resources/TextTexture.java Outdated Show resolved Hide resolved
@ghzdude ghzdude force-pushed the gh-quantum-render-improvements branch from b459b51 to 81f17e9 Compare March 27, 2024 21:14
@ghzdude ghzdude force-pushed the gh-quantum-render-improvements branch from 0ee0a01 to 8709399 Compare March 27, 2024 21:58
@ghzdude ghzdude force-pushed the gh-quantum-render-improvements branch from d996734 to d336641 Compare March 27, 2024 23:24
@ghzdude ghzdude force-pushed the gh-quantum-render-improvements branch from d336641 to 7c2d690 Compare March 27, 2024 23:25
@TechLord22 TechLord22 merged commit 06938f0 into GregTechCEu:master Apr 4, 2024
3 checks passed
ALongStringOfNumbers pushed a commit that referenced this pull request Apr 24, 2024
ALongStringOfNumbers pushed a commit that referenced this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: refactor Suggestion to refactor a section of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants