-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21
src/main/java/net/vulkanmod/render/chunk/build/ThreadBuilderPack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 30 additions & 20 deletions
50
src/main/java/net/vulkanmod/render/vertex/TerrainRenderType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,62 @@ | ||
package net.vulkanmod.render.vertex; | ||
|
||
import it.unimi.dsi.fastutil.objects.ObjectArrayList; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.vulkanmod.Initializer; | ||
import net.vulkanmod.vulkan.VRenderSystem; | ||
|
||
import java.util.Arrays; | ||
import java.util.EnumSet; | ||
import java.util.Hashtable; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public enum TerrainRenderType { | ||
SOLID(RenderType.solid(), 0.0f), | ||
CUTOUT_MIPPED(RenderType.cutoutMipped(), 0.5f), | ||
CUTOUT(RenderType.cutout(), 0.1f), | ||
TRANSLUCENT(RenderType.translucent(), 0.0f), | ||
TRIPWIRE(RenderType.tripwire(), 0.1f); | ||
SOLID(RenderType.solid()), | ||
CUTOUT_MIPPED(RenderType.cutoutMipped()), | ||
CUTOUT(RenderType.cutout()), | ||
TRANSLUCENT(RenderType.translucent()), | ||
TRIPWIRE(RenderType.tripwire()); | ||
|
||
public static final TerrainRenderType[] VALUES = TerrainRenderType.values(); | ||
|
||
public static final EnumSet<TerrainRenderType> COMPACT_RENDER_TYPES = EnumSet.of(CUTOUT_MIPPED, TRANSLUCENT); | ||
public static final EnumSet<TerrainRenderType> SEMI_COMPACT_RENDER_TYPES = EnumSet.of(CUTOUT_MIPPED, CUTOUT, TRANSLUCENT); | ||
|
||
public final int initialSize; | ||
final float alphaCutout; | ||
|
||
TerrainRenderType(RenderType renderType, float alphaCutout) { | ||
this.initialSize = renderType.bufferSize(); | ||
this.alphaCutout = alphaCutout; | ||
public final int bufferSize; | ||
TerrainRenderType(RenderType renderType) { | ||
this.bufferSize = renderType.bufferSize(); | ||
} | ||
public static EnumSet<TerrainRenderType> getActiveLayers() { | ||
return Initializer.CONFIG.uniqueOpaqueLayer ? COMPACT_RENDER_TYPES : SEMI_COMPACT_RENDER_TYPES; | ||
} | ||
|
||
public void setCutoutUniform() { | ||
VRenderSystem.alphaCutout = this.alphaCutout; | ||
public static TerrainRenderType getCompact(String renderType) { | ||
if(Initializer.CONFIG.uniqueOpaqueLayer) { | ||
return switch (renderType) | ||
{ | ||
case "solid", "cutout", "cutout_mipped" -> CUTOUT_MIPPED; | ||
default -> TRANSLUCENT; | ||
}; | ||
|
||
} | ||
else { | ||
return switch (renderType) | ||
{ | ||
case "solid", "cutout_mipped" -> CUTOUT_MIPPED; | ||
case "cutout" -> CUTOUT; | ||
default -> TRANSLUCENT; | ||
}; | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
public static TerrainRenderType get(String renderType) { | ||
return switch (renderType) | ||
{ | ||
case "solid" -> SOLID; | ||
case "cutout_mipped" -> CUTOUT_MIPPED; | ||
case "cutout" -> CUTOUT; | ||
case "translucent" -> TRANSLUCENT; | ||
case "tripwire" -> TRIPWIRE; | ||
default -> throw new IllegalStateException("Unexpected value: " + renderType); | ||
default -> TRANSLUCENT; | ||
}; | ||
} | ||
} |