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: enable block tinting in LOD chunks #4847

Merged
merged 2 commits into from
Aug 23, 2021
Merged

Conversation

naalit
Copy link
Contributor

@naalit naalit commented Aug 16, 2021

Contains

Block tinting previously queried biome information from the WorldProvider. But LOD chunks are never added to the world, just meshed and rendered. All the necessary data is still there, so this switches to passing block tinting systems a ChunkView from which to derive necessary information, which really makes more sense anyway.

How to test

With Terasology/BiomesAPI#18, try enabling LOD chunks in Core Gameplay or Metal Renegades and check that grass and leaves change color in different biomes in LOD chunks.

Here's an example, although it might be hard to see without zooming in:
Terasology-210815201323-1920x1080

@github-actions github-actions bot added the Type: Bug Issues reporting and PRs fixing problems label Aug 16, 2021
@keturn
Copy link
Member

keturn commented Aug 18, 2021

Oh, I see.

public int getExtraData(int index, int x, int y, int z) {
Chunk chunk = chunkProvider.getChunk(Chunks.toChunkPos(x, y, z, new Vector3i()));
if (chunk != null) {
return chunk.getExtraData(index, Chunks.toRelative(x, y, z, new Vector3i()));

So it's not that asking the WorldProvider and a ChunkView return different things for the same location. The issue is that the ChunkProvider doesn't have that chunk handy, because the ChunkView you have is some approximation for a Chunk that isn't really loaded.

The code that ends up using this is already operating on a ChunkView, so introducing ChunkView objects in to that API isn't a problem in practice.

I am troubled by the fact that it leaves us with multiple ways to try to query this data and won't be obvious to people which to use.

I'm not sure what to make of that. Should BiomeManager always operate on ChunkViews instead of the global WorldProvider?

Should WorldProvider not implement the ChunkView interface, to make sure those queries go to a ChunkView instead?

engine/src/main/java/org/terasology/engine/rendering/primitives/BlockMeshGeneratorSingleShape.java
@keturn keturn self-requested a review August 23, 2021 01:04
Copy link
Member

@keturn keturn left a comment

Choose a reason for hiding this comment

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

Tested this out, looks like it is working here.

Still would like to sort out the WorldProvider/ChunkView question, but this PR doesn't have to wait for that.

@keturn keturn merged commit e61a930 into develop Aug 23, 2021
@keturn keturn deleted the fix/lod-block-tinting branch August 23, 2021 14:56
keturn added a commit to Terasology/FlowingLiquids that referenced this pull request Aug 23, 2021
keturn added a commit to Terasology/FlowingLiquids that referenced this pull request Aug 23, 2021
@keturn keturn added this to the v5.2.0 milestone Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants