mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 06:24:12 +01:00
Cut it out!
- Down to just one material shader. - May need some better examples?
This commit is contained in:
parent
301d2f82dd
commit
42c4d311b0
@ -10,7 +10,6 @@ import com.jozufozu.flywheel.lib.util.ShadersModHandler;
|
|||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.Sheets;
|
import net.minecraft.client.renderer.Sheets;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.inventory.InventoryMenu;
|
|
||||||
|
|
||||||
public final class Materials {
|
public final class Materials {
|
||||||
public static final MaterialVertexTransformer SHADING_TRANSFORMER = (vertexList, level) -> {
|
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");
|
private static final ResourceLocation MINECART_LOCATION = new ResourceLocation("textures/entity/minecart.png");
|
||||||
|
|
||||||
public static final Material CHUNK_SOLID_SHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_SOLID_SHADED = SimpleMaterial.builder()
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.shaders(StandardMaterialShaders.SHADED)
|
|
||||||
.fallbackRenderType(RenderType.solid())
|
.fallbackRenderType(RenderType.solid())
|
||||||
.vertexTransformer(SHADING_TRANSFORMER)
|
.vertexTransformer(SHADING_TRANSFORMER)
|
||||||
.build();
|
.build();
|
||||||
public static final Material CHUNK_SOLID_UNSHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_SOLID_UNSHADED = SimpleMaterial.builder()
|
||||||
.diffuse(false)
|
.diffuse(false)
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.fallbackRenderType(RenderType.solid())
|
.fallbackRenderType(RenderType.solid())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Material CHUNK_CUTOUT_MIPPED_SHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_CUTOUT_MIPPED_SHADED = SimpleMaterial.builder()
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.shaders(StandardMaterialShaders.SHADED_CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(RenderType.cutoutMipped())
|
.fallbackRenderType(RenderType.cutoutMipped())
|
||||||
.vertexTransformer(SHADING_TRANSFORMER)
|
.vertexTransformer(SHADING_TRANSFORMER)
|
||||||
.build();
|
.build();
|
||||||
public static final Material CHUNK_CUTOUT_MIPPED_UNSHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_CUTOUT_MIPPED_UNSHADED = SimpleMaterial.builder()
|
||||||
.diffuse(false)
|
.diffuse(false)
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.shaders(StandardMaterialShaders.CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(RenderType.cutoutMipped())
|
.fallbackRenderType(RenderType.cutoutMipped())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Material CHUNK_CUTOUT_SHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_CUTOUT_SHADED = SimpleMaterial.builder()
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(false)
|
.mip(false)
|
||||||
.shaders(StandardMaterialShaders.SHADED_CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(RenderType.cutout())
|
.fallbackRenderType(RenderType.cutout())
|
||||||
.vertexTransformer(SHADING_TRANSFORMER)
|
.vertexTransformer(SHADING_TRANSFORMER)
|
||||||
.build();
|
.build();
|
||||||
public static final Material CHUNK_CUTOUT_UNSHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_CUTOUT_UNSHADED = SimpleMaterial.builder()
|
||||||
.diffuse(false)
|
.diffuse(false)
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(false)
|
.mip(false)
|
||||||
.shaders(StandardMaterialShaders.CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(RenderType.cutout())
|
.fallbackRenderType(RenderType.cutout())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Material CHUNK_TRANSLUCENT_SHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_TRANSLUCENT_SHADED = SimpleMaterial.builder()
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.transparency(Transparency.TRANSLUCENT)
|
.transparency(Transparency.TRANSLUCENT)
|
||||||
.shaders(StandardMaterialShaders.SHADED)
|
|
||||||
.fallbackRenderType(RenderType.translucent())
|
.fallbackRenderType(RenderType.translucent())
|
||||||
.vertexTransformer(SHADING_TRANSFORMER)
|
.vertexTransformer(SHADING_TRANSFORMER)
|
||||||
.build();
|
.build();
|
||||||
public static final Material CHUNK_TRANSLUCENT_UNSHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_TRANSLUCENT_UNSHADED = SimpleMaterial.builder()
|
||||||
.diffuse(false)
|
.diffuse(false)
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.transparency(Transparency.TRANSLUCENT)
|
.transparency(Transparency.TRANSLUCENT)
|
||||||
.fallbackRenderType(RenderType.translucent())
|
.fallbackRenderType(RenderType.translucent())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Material CHUNK_TRIPWIRE_SHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_TRIPWIRE_SHADED = SimpleMaterial.builder()
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.transparency(Transparency.TRANSLUCENT)
|
.transparency(Transparency.TRANSLUCENT)
|
||||||
.shaders(StandardMaterialShaders.SHADED_CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(RenderType.tripwire())
|
.fallbackRenderType(RenderType.tripwire())
|
||||||
.vertexTransformer(SHADING_TRANSFORMER)
|
.vertexTransformer(SHADING_TRANSFORMER)
|
||||||
.build();
|
.build();
|
||||||
public static final Material CHUNK_TRIPWIRE_UNSHADED = SimpleMaterial.builder()
|
public static final Material CHUNK_TRIPWIRE_UNSHADED = SimpleMaterial.builder()
|
||||||
.diffuse(false)
|
.diffuse(false)
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(true)
|
|
||||||
.transparency(Transparency.TRANSLUCENT)
|
.transparency(Transparency.TRANSLUCENT)
|
||||||
.shaders(StandardMaterialShaders.CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(RenderType.tripwire())
|
.fallbackRenderType(RenderType.tripwire())
|
||||||
.build();
|
.build();
|
||||||
@ -115,27 +88,22 @@ public final class Materials {
|
|||||||
public static final Material CHEST = SimpleMaterial.builder()
|
public static final Material CHEST = SimpleMaterial.builder()
|
||||||
.baseTexture(Sheets.CHEST_SHEET)
|
.baseTexture(Sheets.CHEST_SHEET)
|
||||||
.mip(false)
|
.mip(false)
|
||||||
.shaders(StandardMaterialShaders.SHADED)
|
|
||||||
.fallbackRenderType(Sheets.chestSheet())
|
.fallbackRenderType(Sheets.chestSheet())
|
||||||
.build();
|
.build();
|
||||||
public static final Material SHULKER = SimpleMaterial.builder()
|
public static final Material SHULKER = SimpleMaterial.builder()
|
||||||
.baseTexture(Sheets.SHULKER_SHEET)
|
.baseTexture(Sheets.SHULKER_SHEET)
|
||||||
.mip(false)
|
.mip(false)
|
||||||
.backfaceCull(false)
|
.backfaceCull(false)
|
||||||
.shaders(StandardMaterialShaders.SHADED_CUTOUT)
|
|
||||||
.cutout(Cutout.EPSILON)
|
.cutout(Cutout.EPSILON)
|
||||||
.fallbackRenderType(Sheets.shulkerBoxSheet())
|
.fallbackRenderType(Sheets.shulkerBoxSheet())
|
||||||
.build();
|
.build();
|
||||||
public static final Material BELL = SimpleMaterial.builder()
|
public static final Material BELL = SimpleMaterial.builder()
|
||||||
.baseTexture(InventoryMenu.BLOCK_ATLAS)
|
|
||||||
.mip(false)
|
.mip(false)
|
||||||
.shaders(StandardMaterialShaders.SHADED)
|
|
||||||
.fallbackRenderType(Sheets.solidBlockSheet())
|
.fallbackRenderType(Sheets.solidBlockSheet())
|
||||||
.build();
|
.build();
|
||||||
public static final Material MINECART = SimpleMaterial.builder()
|
public static final Material MINECART = SimpleMaterial.builder()
|
||||||
.baseTexture(MINECART_LOCATION)
|
.baseTexture(MINECART_LOCATION)
|
||||||
.mip(false)
|
.mip(false)
|
||||||
.shaders(StandardMaterialShaders.SHADED)
|
|
||||||
.fallbackRenderType(RenderType.entitySolid(MINECART_LOCATION))
|
.fallbackRenderType(RenderType.entitySolid(MINECART_LOCATION))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -9,9 +9,6 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
|
|
||||||
public final class StandardMaterialShaders {
|
public final class StandardMaterialShaders {
|
||||||
public static final MaterialShaders DEFAULT = MaterialShaders.REGISTRY.registerAndGet(new SimpleMaterialShaders(Files.DEFAULT_VERTEX, Files.DEFAULT_FRAGMENT));
|
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() {
|
private StandardMaterialShaders() {
|
||||||
}
|
}
|
||||||
@ -22,14 +19,10 @@ public final class StandardMaterialShaders {
|
|||||||
|
|
||||||
public static final class Files {
|
public static final class Files {
|
||||||
public static final ResourceLocation DEFAULT_VERTEX = Names.DEFAULT.withSuffix(".vert");
|
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 DEFAULT_FRAGMENT = Names.DEFAULT.withSuffix(".frag");
|
||||||
public static final ResourceLocation CUTOUT_FRAGMENT = Names.CUTOUT.withSuffix(".frag");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Names {
|
public static final class Names {
|
||||||
public static final ResourceLocation DEFAULT = Flywheel.rl("material/default");
|
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
#include "flywheel:api/vertex.glsl"
|
|
||||||
#include "flywheel:util/diffuse.glsl"
|
|
||||||
|
|
||||||
void flw_materialVertex() {
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user