Move diffuse declaration to vertex compiler

This commit is contained in:
Jozufozu 2022-02-14 20:45:13 -08:00
parent 20a75321e2
commit 52f66dec9d
5 changed files with 7 additions and 17 deletions

View File

@ -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<InstancingTemplateData> INSTANCING = new Template<>(GLSLVersion.V330, InstancingTemplateData::new);
public static final Template<OneShotTemplateData> ONE_SHOT = new Template<>(GLSLVersion.V150, OneShotTemplateData::new);
public static final Template<FragmentTemplateData> FRAGMENT = new Template<>(GLSLVersion.V150, FragmentTemplateData::new);

View File

@ -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<VertexCompiler.Context, GlShader> {
FileIndexImpl index = new FileIndexImpl();
Templates.DIFFUSE_FILE.getFile().generateFinalSource(index, finalSource);
header.getFile().generateFinalSource(index, finalSource);
key.file.generateFinalSource(index, finalSource);

View File

@ -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.
*
* <p>
* 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.
* </p>
*/
public class TextureBinder {
}

View File

@ -1,5 +1,4 @@
#use "flywheel:context/fog.glsl"
#use "flywheel:core/diffuse.glsl"
uniform float uTime;
uniform mat4 uViewProjection;

View File

@ -1,5 +1,4 @@
#use "flywheel:context/fog.glsl"
#use "flywheel:core/diffuse.glsl"
uniform float uTime;
uniform mat4 uViewProjection;