Flatten core.shader and fix residual merge conflicts

This commit is contained in:
Jozufozu 2022-01-07 12:01:03 -08:00
parent 03c5a41cac
commit 0b334afaca
16 changed files with 15 additions and 55 deletions

View file

@ -19,7 +19,7 @@ import com.jozufozu.flywheel.api.struct.StructType;
import com.jozufozu.flywheel.backend.gl.versioned.GlCompat;
import com.jozufozu.flywheel.config.FlwConfig;
import com.jozufozu.flywheel.config.FlwEngine;
import com.jozufozu.flywheel.core.shader.spec.ProgramSpec;
import com.jozufozu.flywheel.core.shader.ProgramSpec;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;

View file

@ -3,7 +3,7 @@ package com.jozufozu.flywheel.backend;
import java.util.HashMap;
import java.util.Map;
import com.jozufozu.flywheel.core.shader.gamestate.GameStateProvider;
import com.jozufozu.flywheel.core.shader.GameStateProvider;
import net.minecraft.resources.ResourceLocation;

View file

@ -10,7 +10,7 @@ import com.jozufozu.flywheel.backend.source.Resolver;
import com.jozufozu.flywheel.backend.source.ShaderLoadingException;
import com.jozufozu.flywheel.backend.source.ShaderSources;
import com.jozufozu.flywheel.core.crumbling.CrumblingRenderer;
import com.jozufozu.flywheel.core.shader.spec.ProgramSpec;
import com.jozufozu.flywheel.core.shader.ProgramSpec;
import com.jozufozu.flywheel.event.GatherContextEvent;
import com.jozufozu.flywheel.util.ResourceUtil;
import com.jozufozu.flywheel.util.StringUtil;

View file

@ -8,8 +8,8 @@ import com.jozufozu.flywheel.backend.source.Resolver;
import com.jozufozu.flywheel.core.crumbling.CrumblingProgram;
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
import com.jozufozu.flywheel.core.pipeline.WorldCompiler;
import com.jozufozu.flywheel.core.shader.NormalDebugStateProvider;
import com.jozufozu.flywheel.core.shader.WorldProgram;
import com.jozufozu.flywheel.core.shader.gamestate.NormalDebugStateProvider;
import com.jozufozu.flywheel.event.GatherContextEvent;
import com.jozufozu.flywheel.util.ResourceUtil;

View file

@ -15,8 +15,8 @@ import com.jozufozu.flywheel.backend.source.ShaderLoadingException;
import com.jozufozu.flywheel.core.pipeline.CachingCompiler;
import com.jozufozu.flywheel.core.pipeline.CompilationContext;
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
import com.jozufozu.flywheel.core.shader.ProgramSpec;
import com.jozufozu.flywheel.core.shader.WorldProgram;
import com.jozufozu.flywheel.core.shader.spec.ProgramSpec;
import net.minecraft.resources.ResourceLocation;

View file

@ -5,7 +5,7 @@ import java.util.Objects;
import com.jozufozu.flywheel.api.vertex.VertexType;
import com.jozufozu.flywheel.backend.RenderLayer;
import com.jozufozu.flywheel.backend.source.SourceFile;
import com.jozufozu.flywheel.core.shader.spec.ProgramSpec;
import com.jozufozu.flywheel.core.shader.ProgramSpec;
/**
* Represents the entire context of a program's usage.

View file

@ -7,7 +7,6 @@ import javax.annotation.Nonnull;
import com.jozufozu.flywheel.backend.ShaderContext;
import com.jozufozu.flywheel.backend.gl.shader.GlProgram;
import com.jozufozu.flywheel.core.shader.extension.ExtensionInstance;
import net.minecraft.resources.ResourceLocation;

View file

@ -1,4 +1,4 @@
package com.jozufozu.flywheel.core.shader.extension;
package com.jozufozu.flywheel.core.shader;
import net.minecraft.resources.ResourceLocation;

View file

@ -1,4 +1,4 @@
package com.jozufozu.flywheel.core.shader.gamestate;
package com.jozufozu.flywheel.core.shader;
import com.jozufozu.flywheel.backend.GameStateRegistry;
import com.mojang.serialization.Codec;

View file

@ -1,11 +1,11 @@
package com.jozufozu.flywheel.core.shader.gamestate;
package com.jozufozu.flywheel.core.shader;
import com.jozufozu.flywheel.Flywheel;
import com.jozufozu.flywheel.config.FlwConfig;
import net.minecraft.resources.ResourceLocation;
public class NormalDebugStateProvider implements IGameStateProvider {
public class NormalDebugStateProvider implements GameStateProvider {
public static final NormalDebugStateProvider INSTANCE = new NormalDebugStateProvider();
public static final ResourceLocation NAME = Flywheel.rl("normal_debug");

View file

@ -1,4 +1,4 @@
package com.jozufozu.flywheel.core.shader.spec;
package com.jozufozu.flywheel.core.shader;
import java.util.ArrayList;
import java.util.Collections;

View file

@ -1,16 +1,15 @@
package com.jozufozu.flywheel.core.shader.spec;
package com.jozufozu.flywheel.core.shader;
import java.util.Collections;
import java.util.List;
import com.jozufozu.flywheel.core.shader.gamestate.IGameStateProvider;
import com.jozufozu.flywheel.util.CodecUtil;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
public record ProgramState(IGameStateProvider context, List<String> defines) {
public record ProgramState(GameStateProvider context, List<String> defines) {
public static final Codec<ProgramState> CODEC = RecordCodecBuilder.create(state -> state.group(IGameStateProvider.CODEC.fieldOf("when")
public static final Codec<ProgramState> CODEC = RecordCodecBuilder.create(state -> state.group(GameStateProvider.CODEC.fieldOf("when")
.forGetter(ProgramState::context), CodecUtil.oneOrMore(Codec.STRING)
.optionalFieldOf("define", Collections.emptyList())
.forGetter(ProgramState::defines))

View file

@ -1,4 +1,4 @@
package com.jozufozu.flywheel.core.shader.extension;
package com.jozufozu.flywheel.core.shader;
import org.lwjgl.opengl.GL20;

View file

@ -4,7 +4,6 @@ import static org.lwjgl.opengl.GL20.glUniform1f;
import static org.lwjgl.opengl.GL20.glUniform2f;
import static org.lwjgl.opengl.GL20.glUniform3f;
import com.jozufozu.flywheel.core.shader.extension.WorldFog;
import com.jozufozu.flywheel.util.AnimationTickHolder;
import com.mojang.blaze3d.platform.Window;
import com.mojang.math.Matrix4f;

View file

@ -1,24 +0,0 @@
package com.jozufozu.flywheel.core.shader.extension;
import com.jozufozu.flywheel.Flywheel;
import com.jozufozu.flywheel.backend.gl.shader.GlProgram;
import net.minecraft.resources.ResourceLocation;
public class UnitExtensionInstance implements ExtensionInstance {
public static final ResourceLocation NAME = Flywheel.rl("unit");
public UnitExtensionInstance(GlProgram program) {
}
@Override
public void bind() {
}
@Override
public ResourceLocation name() {
return NAME;
}
}

View file

@ -1,13 +0,0 @@
package com.jozufozu.flywheel.core.shader.spec;
import com.jozufozu.flywheel.core.shader.gamestate.GameStateProvider;
public interface BooleanStateProvider extends GameStateProvider {
boolean isTrue();
@Override
default Boolean getValue() {
return isTrue();
}
}