From 08b331fe18c32928011269b0880a72e32ac71fd2 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 14 Feb 2022 20:45:13 -0800 Subject: [PATCH] Move diffuse declaration to vertex compiler --- .../com/jozufozu/flywheel/core/Templates.java | 5 +++++ .../flywheel/core/compile/VertexCompiler.java | 2 ++ .../com/jozufozu/flywheel/util/TextureBinder.java | 15 --------------- .../flywheel/shaders/context/crumbling.glsl | 1 - .../flywheel/flywheel/shaders/context/world.glsl | 1 - 5 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 src/main/java/com/jozufozu/flywheel/util/TextureBinder.java diff --git a/src/main/java/com/jozufozu/flywheel/core/Templates.java b/src/main/java/com/jozufozu/flywheel/core/Templates.java index 59b538a2f..30987940b 100644 --- a/src/main/java/com/jozufozu/flywheel/core/Templates.java +++ b/src/main/java/com/jozufozu/flywheel/core/Templates.java @@ -1,13 +1,18 @@ package com.jozufozu.flywheel.core; +import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.backend.gl.GLSLVersion; import com.jozufozu.flywheel.core.compile.FragmentTemplateData; import com.jozufozu.flywheel.core.compile.InstancingTemplateData; import com.jozufozu.flywheel.core.compile.OneShotTemplateData; import com.jozufozu.flywheel.core.compile.Template; +import com.jozufozu.flywheel.core.source.FileResolution; +import com.jozufozu.flywheel.core.source.Resolver; public class Templates { + public static final FileResolution DIFFUSE_FILE = Resolver.INSTANCE.get(Flywheel.rl("core/diffuse.glsl")); + public static final Template INSTANCING = new Template<>(GLSLVersion.V330, InstancingTemplateData::new); public static final Template ONE_SHOT = new Template<>(GLSLVersion.V150, OneShotTemplateData::new); public static final Template FRAGMENT = new Template<>(GLSLVersion.V150, FragmentTemplateData::new); diff --git a/src/main/java/com/jozufozu/flywheel/core/compile/VertexCompiler.java b/src/main/java/com/jozufozu/flywheel/core/compile/VertexCompiler.java index 6487c45c4..08e63a93b 100644 --- a/src/main/java/com/jozufozu/flywheel/core/compile/VertexCompiler.java +++ b/src/main/java/com/jozufozu/flywheel/core/compile/VertexCompiler.java @@ -5,6 +5,7 @@ import java.util.Objects; import com.jozufozu.flywheel.api.vertex.VertexType; import com.jozufozu.flywheel.backend.gl.shader.GlShader; import com.jozufozu.flywheel.backend.gl.shader.ShaderType; +import com.jozufozu.flywheel.core.Templates; import com.jozufozu.flywheel.core.shader.StateSnapshot; import com.jozufozu.flywheel.core.source.FileIndexImpl; import com.jozufozu.flywheel.core.source.FileResolution; @@ -40,6 +41,7 @@ public class VertexCompiler extends Memoizer { FileIndexImpl index = new FileIndexImpl(); + Templates.DIFFUSE_FILE.getFile().generateFinalSource(index, finalSource); header.getFile().generateFinalSource(index, finalSource); key.file.generateFinalSource(index, finalSource); diff --git a/src/main/java/com/jozufozu/flywheel/util/TextureBinder.java b/src/main/java/com/jozufozu/flywheel/util/TextureBinder.java deleted file mode 100644 index e90435078..000000000 --- a/src/main/java/com/jozufozu/flywheel/util/TextureBinder.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.jozufozu.flywheel.util; - -import net.minecraft.client.renderer.RenderType; - -/** - * This is a silly hack that's needed because flywheel does things too different from vanilla. - * - *

- * When a {@link RenderType} is setup, the associated textures are "bound" within RenderSystem, but not actually - * bound via opengl. This class provides a helper function to forward the bindings to opengl. - *

- */ -public class TextureBinder { - -} diff --git a/src/main/resources/assets/flywheel/flywheel/shaders/context/crumbling.glsl b/src/main/resources/assets/flywheel/flywheel/shaders/context/crumbling.glsl index 958941126..423977c8a 100644 --- a/src/main/resources/assets/flywheel/flywheel/shaders/context/crumbling.glsl +++ b/src/main/resources/assets/flywheel/flywheel/shaders/context/crumbling.glsl @@ -1,5 +1,4 @@ #use "flywheel:context/fog.glsl" -#use "flywheel:core/diffuse.glsl" uniform float uTime; uniform mat4 uViewProjection; diff --git a/src/main/resources/assets/flywheel/flywheel/shaders/context/world.glsl b/src/main/resources/assets/flywheel/flywheel/shaders/context/world.glsl index 28e36ab3d..b6386e92d 100644 --- a/src/main/resources/assets/flywheel/flywheel/shaders/context/world.glsl +++ b/src/main/resources/assets/flywheel/flywheel/shaders/context/world.glsl @@ -1,5 +1,4 @@ #use "flywheel:context/fog.glsl" -#use "flywheel:core/diffuse.glsl" uniform float uTime; uniform mat4 uViewProjection;