From 90ae50a5ca8868f82ef1e1a36eb6edd026d71cfd Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 1 Dec 2023 23:59:51 -0800 Subject: [PATCH] Cut it out! - Down to just one material shader. - May need some better examples? --- .../flywheel/lib/material/Materials.java | 32 ------------------- .../lib/material/StandardMaterialShaders.java | 7 ---- .../flywheel/flywheel/material/cutout.frag | 13 -------- .../flywheel/flywheel/material/shaded.vert | 6 ---- 4 files changed, 58 deletions(-) delete mode 100644 src/main/resources/assets/flywheel/flywheel/material/cutout.frag delete mode 100644 src/main/resources/assets/flywheel/flywheel/material/shaded.vert diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java b/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java index 48200aa98..a4f59cc46 100644 --- a/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java +++ b/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java @@ -10,7 +10,6 @@ import com.jozufozu.flywheel.lib.util.ShadersModHandler; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.InventoryMenu; public final class Materials { public static final MaterialVertexTransformer SHADING_TRANSFORMER = (vertexList, level) -> { @@ -30,84 +29,58 @@ public final class Materials { private static final ResourceLocation MINECART_LOCATION = new ResourceLocation("textures/entity/minecart.png"); public static final Material CHUNK_SOLID_SHADED = SimpleMaterial.builder() - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) - .shaders(StandardMaterialShaders.SHADED) .fallbackRenderType(RenderType.solid()) .vertexTransformer(SHADING_TRANSFORMER) .build(); public static final Material CHUNK_SOLID_UNSHADED = SimpleMaterial.builder() .diffuse(false) - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) .fallbackRenderType(RenderType.solid()) .build(); public static final Material CHUNK_CUTOUT_MIPPED_SHADED = SimpleMaterial.builder() - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) - .shaders(StandardMaterialShaders.SHADED_CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(RenderType.cutoutMipped()) .vertexTransformer(SHADING_TRANSFORMER) .build(); public static final Material CHUNK_CUTOUT_MIPPED_UNSHADED = SimpleMaterial.builder() .diffuse(false) - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) - .shaders(StandardMaterialShaders.CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(RenderType.cutoutMipped()) .build(); public static final Material CHUNK_CUTOUT_SHADED = SimpleMaterial.builder() - .baseTexture(InventoryMenu.BLOCK_ATLAS) .mip(false) - .shaders(StandardMaterialShaders.SHADED_CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(RenderType.cutout()) .vertexTransformer(SHADING_TRANSFORMER) .build(); public static final Material CHUNK_CUTOUT_UNSHADED = SimpleMaterial.builder() .diffuse(false) - .baseTexture(InventoryMenu.BLOCK_ATLAS) .mip(false) - .shaders(StandardMaterialShaders.CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(RenderType.cutout()) .build(); public static final Material CHUNK_TRANSLUCENT_SHADED = SimpleMaterial.builder() - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) .transparency(Transparency.TRANSLUCENT) - .shaders(StandardMaterialShaders.SHADED) .fallbackRenderType(RenderType.translucent()) .vertexTransformer(SHADING_TRANSFORMER) .build(); public static final Material CHUNK_TRANSLUCENT_UNSHADED = SimpleMaterial.builder() .diffuse(false) - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) .transparency(Transparency.TRANSLUCENT) .fallbackRenderType(RenderType.translucent()) .build(); public static final Material CHUNK_TRIPWIRE_SHADED = SimpleMaterial.builder() - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) .transparency(Transparency.TRANSLUCENT) - .shaders(StandardMaterialShaders.SHADED_CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(RenderType.tripwire()) .vertexTransformer(SHADING_TRANSFORMER) .build(); public static final Material CHUNK_TRIPWIRE_UNSHADED = SimpleMaterial.builder() .diffuse(false) - .baseTexture(InventoryMenu.BLOCK_ATLAS) - .mip(true) .transparency(Transparency.TRANSLUCENT) - .shaders(StandardMaterialShaders.CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(RenderType.tripwire()) .build(); @@ -115,27 +88,22 @@ public final class Materials { public static final Material CHEST = SimpleMaterial.builder() .baseTexture(Sheets.CHEST_SHEET) .mip(false) - .shaders(StandardMaterialShaders.SHADED) .fallbackRenderType(Sheets.chestSheet()) .build(); public static final Material SHULKER = SimpleMaterial.builder() .baseTexture(Sheets.SHULKER_SHEET) .mip(false) .backfaceCull(false) - .shaders(StandardMaterialShaders.SHADED_CUTOUT) .cutout(Cutout.EPSILON) .fallbackRenderType(Sheets.shulkerBoxSheet()) .build(); public static final Material BELL = SimpleMaterial.builder() - .baseTexture(InventoryMenu.BLOCK_ATLAS) .mip(false) - .shaders(StandardMaterialShaders.SHADED) .fallbackRenderType(Sheets.solidBlockSheet()) .build(); public static final Material MINECART = SimpleMaterial.builder() .baseTexture(MINECART_LOCATION) .mip(false) - .shaders(StandardMaterialShaders.SHADED) .fallbackRenderType(RenderType.entitySolid(MINECART_LOCATION)) .build(); diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java b/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java index a642ff4b8..a143f21f6 100644 --- a/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java +++ b/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java @@ -9,9 +9,6 @@ import net.minecraft.resources.ResourceLocation; public final class StandardMaterialShaders { public static final MaterialShaders DEFAULT = MaterialShaders.REGISTRY.registerAndGet(new SimpleMaterialShaders(Files.DEFAULT_VERTEX, Files.DEFAULT_FRAGMENT)); - public static final MaterialShaders SHADED = MaterialShaders.REGISTRY.registerAndGet(new SimpleMaterialShaders(Files.SHADED_VERTEX, Files.DEFAULT_FRAGMENT)); - public static final MaterialShaders CUTOUT = MaterialShaders.REGISTRY.registerAndGet(new SimpleMaterialShaders(Files.DEFAULT_VERTEX, Files.CUTOUT_FRAGMENT)); - public static final MaterialShaders SHADED_CUTOUT = MaterialShaders.REGISTRY.registerAndGet(new SimpleMaterialShaders(Files.SHADED_VERTEX, Files.CUTOUT_FRAGMENT)); private StandardMaterialShaders() { } @@ -22,14 +19,10 @@ public final class StandardMaterialShaders { public static final class Files { public static final ResourceLocation DEFAULT_VERTEX = Names.DEFAULT.withSuffix(".vert"); - public static final ResourceLocation SHADED_VERTEX = Names.SHADED.withSuffix(".vert"); public static final ResourceLocation DEFAULT_FRAGMENT = Names.DEFAULT.withSuffix(".frag"); - public static final ResourceLocation CUTOUT_FRAGMENT = Names.CUTOUT.withSuffix(".frag"); } public static final class Names { public static final ResourceLocation DEFAULT = Flywheel.rl("material/default"); - public static final ResourceLocation SHADED = Flywheel.rl("material/shaded"); - public static final ResourceLocation CUTOUT = Flywheel.rl("material/cutout"); } } diff --git a/src/main/resources/assets/flywheel/flywheel/material/cutout.frag b/src/main/resources/assets/flywheel/flywheel/material/cutout.frag deleted file mode 100644 index 6ff475fc3..000000000 --- a/src/main/resources/assets/flywheel/flywheel/material/cutout.frag +++ /dev/null @@ -1,13 +0,0 @@ -#include "flywheel:api/fragment.glsl" -#include "flywheel:util/fog.glsl" - -void flw_materialFragment() { -} - -bool flw_discardPredicate(vec4 finalColor) { - return finalColor.a < 0.1; -} - -vec4 flw_fogFilter(vec4 color) { - return linear_fog(color, flw_distance, flywheel.fogRange.x, flywheel.fogRange.y, flywheel.fogColor); -} diff --git a/src/main/resources/assets/flywheel/flywheel/material/shaded.vert b/src/main/resources/assets/flywheel/flywheel/material/shaded.vert deleted file mode 100644 index e25e78371..000000000 --- a/src/main/resources/assets/flywheel/flywheel/material/shaded.vert +++ /dev/null @@ -1,6 +0,0 @@ -#include "flywheel:api/vertex.glsl" -#include "flywheel:util/diffuse.glsl" - -void flw_materialVertex() { - -}