Bilinear interpolation for quad vertex data via geometry shader #12

Closed
embeddedt wants to merge 18 commits from geotesting into stonecutter
pull from: geotesting
5 changed files with 15 additions and 89 deletions
Showing only changes of commit e11add07ac - Show all commits

No files matched your search

@@ -25,7 +25,6 @@ import java.util.Collection;
public class PrimitiveRenderSectionManager extends RenderSectionManager { public class PrimitiveRenderSectionManager extends RenderSectionManager {
private final World world; private final World world;
private final ReferenceSet<RenderSection> sectionsWithGlobalEntities = new ReferenceOpenHashSet<>();
public PrimitiveRenderSectionManager(RenderPassConfiguration<?> configuration, World world, int renderDistance, CommandList commandList, int minSection, int maxSection, int requestedThreads) { public PrimitiveRenderSectionManager(RenderPassConfiguration<?> configuration, World world, int renderDistance, CommandList commandList, int minSection, int maxSection, int requestedThreads) {
super(configuration, () -> new PrimitiveChunkBuildContext(world, configuration), DefaultChunkRenderer::new, renderDistance, commandList, minSection, maxSection, requestedThreads); super(configuration, () -> new PrimitiveChunkBuildContext(world, configuration), DefaultChunkRenderer::new, renderDistance, commandList, minSection, maxSection, requestedThreads);
@@ -83,25 +82,4 @@ public class PrimitiveRenderSectionManager extends RenderSectionManager {
protected boolean allowImportantRebuilds() { protected boolean allowImportantRebuilds() {
return false; return false;
} }
@Override
protected void updateSectionInfo(RenderSection render, BuiltRenderSectionData info) {
super.updateSectionInfo(render, info);
if (info == null || (info instanceof MinecraftBuiltRenderSectionData<?, ?> mcInfo) && mcInfo.globalBlockEntities.isEmpty()) {
this.sectionsWithGlobalEntities.remove(render);
} else {
this.sectionsWithGlobalEntities.add(render);
}
}
@Override
public void destroy() {
super.destroy();
this.sectionsWithGlobalEntities.clear();
}
public Collection<RenderSection> getSectionsWithGlobalEntities() {
return ReferenceSets.unmodifiable(this.sectionsWithGlobalEntities);
}
} }
@@ -15,6 +15,7 @@ import org.embeddedt.embeddium.impl.render.chunk.compile.tasks.ChunkBuilderSortT
import org.embeddedt.embeddium.impl.render.chunk.compile.tasks.ChunkBuilderTask; import org.embeddedt.embeddium.impl.render.chunk.compile.tasks.ChunkBuilderTask;
import org.embeddedt.embeddium.impl.render.chunk.data.BuiltRenderSectionData; import org.embeddedt.embeddium.impl.render.chunk.data.BuiltRenderSectionData;
import org.embeddedt.embeddium.impl.render.chunk.data.BuiltSectionMeshParts; import org.embeddedt.embeddium.impl.render.chunk.data.BuiltSectionMeshParts;
import org.embeddedt.embeddium.impl.render.chunk.data.MinecraftBuiltRenderSectionData;
import org.embeddedt.embeddium.impl.render.chunk.lists.ChunkRenderList; import org.embeddedt.embeddium.impl.render.chunk.lists.ChunkRenderList;
import org.embeddedt.embeddium.impl.render.chunk.lists.RenderListManager; import org.embeddedt.embeddium.impl.render.chunk.lists.RenderListManager;
import org.embeddedt.embeddium.impl.render.chunk.lists.SectionTicker; import org.embeddedt.embeddium.impl.render.chunk.lists.SectionTicker;
@@ -75,6 +76,8 @@ public abstract class RenderSectionManager {
@Nullable @Nullable
private final RenderListManager shadowRenderListManager; private final RenderListManager shadowRenderListManager;
protected final ReferenceSet<RenderSection> sectionsWithGlobalEntities = new ReferenceOpenHashSet<>();
public RenderSectionManager(RenderPassConfiguration<?> configuration, Supplier<ChunkBuildContext> contextSupplier, BiFunction<RenderDevice, RenderPassConfiguration<?>, ChunkRenderer> chunkRenderer, int renderDistance, CommandList commandList, int minSection, int maxSection, int requestedThreads) { public RenderSectionManager(RenderPassConfiguration<?> configuration, Supplier<ChunkBuildContext> contextSupplier, BiFunction<RenderDevice, RenderPassConfiguration<?>, ChunkRenderer> chunkRenderer, int renderDistance, CommandList commandList, int minSection, int maxSection, int requestedThreads) {
this.chunkRenderer = chunkRenderer.apply(RenderDevice.INSTANCE, configuration); this.chunkRenderer = chunkRenderer.apply(RenderDevice.INSTANCE, configuration);
@@ -418,6 +421,12 @@ public abstract class RenderSectionManager {
if (this.shadowRenderListManager != null) { if (this.shadowRenderListManager != null) {
this.shadowRenderListManager.updateVisibilityData(render.getChunkX(), render.getChunkY(), render.getChunkZ(), visibilityData); this.shadowRenderListManager.updateVisibilityData(render.getChunkX(), render.getChunkY(), render.getChunkZ(), visibilityData);
} }
if (!(info instanceof MinecraftBuiltRenderSectionData<?, ?> data)) {
this.sectionsWithGlobalEntities.remove(render);
} else if (!data.globalBlockEntities.isEmpty()) {
this.sectionsWithGlobalEntities.add(render);
}
} }
private static List<ChunkBuildOutput> filterChunkBuildResults(ArrayList<ChunkBuildOutput> outputs) { private static List<ChunkBuildOutput> filterChunkBuildResults(ArrayList<ChunkBuildOutput> outputs) {
@@ -547,6 +556,8 @@ public abstract class RenderSectionManager {
this.regions.delete(commandList); this.regions.delete(commandList);
this.chunkRenderer.delete(commandList); this.chunkRenderer.delete(commandList);
} }
this.sectionsWithGlobalEntities.clear();
} }
public int getTotalSections() { public int getTotalSections() {
@@ -757,4 +768,8 @@ public abstract class RenderSectionManager {
this.disabledRenderPasses.add(pass); this.disabledRenderPasses.add(pass);
} }
} }
public final Collection<RenderSection> getSectionsWithGlobalEntities() {
return ReferenceSets.unmodifiable(this.sectionsWithGlobalEntities);
}
} }
@@ -38,7 +38,6 @@ import java.util.List;
public class VintageRenderSectionManager extends RenderSectionManager { public class VintageRenderSectionManager extends RenderSectionManager {
private final WorldClient world; private final WorldClient world;
private final ReferenceSet<RenderSection> sectionsWithGlobalEntities = new ReferenceOpenHashSet<>();
@Getter @Getter
private final ClonedChunkSectionCache sectionCache; private final ClonedChunkSectionCache sectionCache;
@@ -113,27 +112,6 @@ public class VintageRenderSectionManager extends RenderSectionManager {
return false; return false;
} }
@Override
protected void updateSectionInfo(RenderSection render, BuiltRenderSectionData info) {
super.updateSectionInfo(render, info);
if (info == null || (info instanceof MinecraftBuiltRenderSectionData<?, ?> mcInfo) && mcInfo.globalBlockEntities.isEmpty()) {
this.sectionsWithGlobalEntities.remove(render);
} else {
this.sectionsWithGlobalEntities.add(render);
}
}
@Override
public void destroy() {
super.destroy();
this.sectionsWithGlobalEntities.clear();
}
public Collection<RenderSection> getSectionsWithGlobalEntities() {
return ReferenceSets.unmodifiable(this.sectionsWithGlobalEntities);
}
@Override @Override
protected void scheduleSectionForRebuild(int x, int y, int z, boolean important) { protected void scheduleSectionForRebuild(int x, int y, int z, boolean important) {
this.sectionCache.invalidate(x, y, z); this.sectionCache.invalidate(x, y, z);
@@ -30,7 +30,6 @@ import java.util.List;
public class ArchaicRenderSectionManager extends RenderSectionManager { public class ArchaicRenderSectionManager extends RenderSectionManager {
private final WorldClient world; private final WorldClient world;
private final ReferenceSet<RenderSection> sectionsWithGlobalEntities = new ReferenceOpenHashSet<>();
public ArchaicRenderSectionManager(RenderPassConfiguration<?> configuration, WorldClient world, int renderDistance, CommandList commandList, int minSection, int maxSection, int requestedThreads) { public ArchaicRenderSectionManager(RenderPassConfiguration<?> configuration, WorldClient world, int renderDistance, CommandList commandList, int minSection, int maxSection, int requestedThreads) {
super(configuration, () -> new ArchaicChunkBuildContext(world, configuration), DefaultChunkRenderer::new, renderDistance, commandList, minSection, maxSection, requestedThreads); super(configuration, () -> new ArchaicChunkBuildContext(world, configuration), DefaultChunkRenderer::new, renderDistance, commandList, minSection, maxSection, requestedThreads);
@@ -96,27 +95,6 @@ public class ArchaicRenderSectionManager extends RenderSectionManager {
return false; return false;
} }
@Override
protected void updateSectionInfo(RenderSection render, BuiltRenderSectionData info) {
super.updateSectionInfo(render, info);
if (info == null || (info instanceof MinecraftBuiltRenderSectionData<?, ?> mcInfo) && mcInfo.globalBlockEntities.isEmpty()) {
this.sectionsWithGlobalEntities.remove(render);
} else {
this.sectionsWithGlobalEntities.add(render);
}
}
@Override
public void destroy() {
super.destroy();
this.sectionsWithGlobalEntities.clear();
}
public Collection<RenderSection> getSectionsWithGlobalEntities() {
return ReferenceSets.unmodifiable(this.sectionsWithGlobalEntities);
}
@Override @Override
protected @Nullable SectionTicker createSectionTicker() { protected @Nullable SectionTicker createSectionTicker() {
return new GenericSectionSpriteTicker<>(SpriteUtil::markSpriteActive); return new GenericSectionSpriteTicker<>(SpriteUtil::markSpriteActive);
@@ -47,8 +47,6 @@ public class ModernRenderSectionManager extends RenderSectionManager {
@Getter @Getter
private final ClonedChunkSectionCache sectionCache; private final ClonedChunkSectionCache sectionCache;
private final ReferenceSet<RenderSection> sectionsWithGlobalEntities = new ReferenceOpenHashSet<>();
protected ModernRenderSectionManager(RenderPassConfiguration<RenderType> configuration, ClientLevel world, int renderDistance, CommandList commandList) { protected ModernRenderSectionManager(RenderPassConfiguration<RenderType> configuration, ClientLevel world, int renderDistance, CommandList commandList) {
super(configuration, super(configuration,
() -> new ModernChunkBuildContext(world, configuration), () -> new ModernChunkBuildContext(world, configuration),
@@ -130,27 +128,6 @@ public class ModernRenderSectionManager extends RenderSectionManager {
return new GenericSectionSpriteTicker<>(SpriteUtil::markSpriteActive); return new GenericSectionSpriteTicker<>(SpriteUtil::markSpriteActive);
} }
@Override
protected void updateSectionInfo(RenderSection render, BuiltRenderSectionData info) {
super.updateSectionInfo(render, info);
if (info == null || (info instanceof MinecraftBuiltRenderSectionData<?, ?> mcInfo) && mcInfo.globalBlockEntities.isEmpty()) {
this.sectionsWithGlobalEntities.remove(render);
} else {
this.sectionsWithGlobalEntities.add(render);
}
}
@Override
public void destroy() {
super.destroy();
this.sectionsWithGlobalEntities.clear();
}
public Collection<RenderSection> getSectionsWithGlobalEntities() {
return ReferenceSets.unmodifiable(this.sectionsWithGlobalEntities);
}
@Override @Override
protected boolean useFogOcclusion() { protected boolean useFogOcclusion() {
return Celeritas.options().performance.useFogOcclusion; return Celeritas.options().performance.useFogOcclusion;