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

Fix liquid drawtype faces sometimes not rendering #12807

Merged
merged 4 commits into from
Sep 26, 2022

Conversation

Wuzzy2
Copy link
Contributor

@Wuzzy2 Wuzzy2 commented Sep 24, 2022

Fixes #12718.

Implementation details

The problem was, as I have suspected, that the rendering code checked liquidtype instead of the drawtype via isLiquid and sameLiquid. This is incorrect because liquid flowing physics are supposed to be completely independent from liquid rendering.

So the bugfix is check for the drawtype only, not liquidtype, because it's about rendering, not liquid flowing.

The sameLiquid function was removed because it had only one caller. It has been replaced by sameLiquidRender.

How to test

Use the drawtype test nodes from DevTest (like testnodes:liquid_3) and surround them in glass (testnodes:glasslike). Viewed from every side, the liquid must look correctly.

Surround the various other liquid test nodes with glass for comparison.

Also you might test liquids in DevTest in general to make sure that other liquid features weren't accidentally broken.

src/nodedef.h Outdated Show resolved Hide resolved
@Wuzzy2
Copy link
Contributor Author

Wuzzy2 commented Sep 25, 2022

What is a "non-liquid"? The alternative liquid IDs are required for rendering, too. Have you considered nodes with a liquid drawtype but liquidtype="none"?

@SmallJoker
Copy link
Member

@Wuzzy2 Even though I cannot quite grasp why you would want that combination of parameters, it does not matter because the content ID assignment and sameLiquidRender depend on isLiquidRender. Hence you can compare content IDs directly because the render type "condition" is already included in its value.

@Wuzzy2
Copy link
Contributor Author

Wuzzy2 commented Sep 25, 2022

So do you assume that all liquid-related nodes (be it liquids that physically flow or just nodes that only have the liquid drawtypes, without flowing) have the alternative nodes set? If yes, then the documentation needs updating as well because currently, the documentation makes it seem as that defining the "alternative" liquids is optional.

@SmallJoker
Copy link
Member

SmallJoker commented Sep 25, 2022

I do not need to assume. liquid_alternative_flowing_id is only set to a non-CONTENT_IGNORE value when isLiquidRender() == true (also visible in your patch). If any other behaviour should be possible, there's either an issue in the PR or in my understanding.

@Wuzzy2
Copy link
Contributor Author

Wuzzy2 commented Sep 25, 2022

Okay, I made a mistake in the code that sets the alternative liquid IDs. I removed the check for liquidtype, which was unreasonable. Obviously, we want the alternative liquid IDs to be set in either case: liquidtype != "none" and/or a liquid/flowingliquid drawtype. I had a brainfart, basically. :D

Now that I have changed this line again, this is now just a syntactical sugar change (you can see it in the full files diff).

@Wuzzy2
Copy link
Contributor Author

Wuzzy2 commented Sep 25, 2022

I have changed the checks in sameLiquidRender as well. The name check is gone because string checks are slow. It was unneccessary as well.

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

Works.

Copy link
Contributor

@TurkeyMcMac TurkeyMcMac left a comment

Choose a reason for hiding this comment

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

Looks good.

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

Successfully merging this pull request may close these issues.

liquidtype = "none" causes north/east/up faces in contact with transparent nodes to not be drawn
3 participants