mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-27 21:37:56 +01:00
Flatten core.shader and fix residual merge conflicts
This commit is contained in:
parent
03c5a41cac
commit
0b334afaca
16 changed files with 15 additions and 55 deletions
|
@ -19,7 +19,7 @@ import com.jozufozu.flywheel.api.struct.StructType;
|
||||||
import com.jozufozu.flywheel.backend.gl.versioned.GlCompat;
|
import com.jozufozu.flywheel.backend.gl.versioned.GlCompat;
|
||||||
import com.jozufozu.flywheel.config.FlwConfig;
|
import com.jozufozu.flywheel.config.FlwConfig;
|
||||||
import com.jozufozu.flywheel.config.FlwEngine;
|
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.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.jozufozu.flywheel.backend;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.core.shader.gamestate.GameStateProvider;
|
import com.jozufozu.flywheel.core.shader.GameStateProvider;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.jozufozu.flywheel.backend.source.Resolver;
|
||||||
import com.jozufozu.flywheel.backend.source.ShaderLoadingException;
|
import com.jozufozu.flywheel.backend.source.ShaderLoadingException;
|
||||||
import com.jozufozu.flywheel.backend.source.ShaderSources;
|
import com.jozufozu.flywheel.backend.source.ShaderSources;
|
||||||
import com.jozufozu.flywheel.core.crumbling.CrumblingRenderer;
|
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.event.GatherContextEvent;
|
||||||
import com.jozufozu.flywheel.util.ResourceUtil;
|
import com.jozufozu.flywheel.util.ResourceUtil;
|
||||||
import com.jozufozu.flywheel.util.StringUtil;
|
import com.jozufozu.flywheel.util.StringUtil;
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.jozufozu.flywheel.backend.source.Resolver;
|
||||||
import com.jozufozu.flywheel.core.crumbling.CrumblingProgram;
|
import com.jozufozu.flywheel.core.crumbling.CrumblingProgram;
|
||||||
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
|
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
|
||||||
import com.jozufozu.flywheel.core.pipeline.WorldCompiler;
|
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.WorldProgram;
|
||||||
import com.jozufozu.flywheel.core.shader.gamestate.NormalDebugStateProvider;
|
|
||||||
import com.jozufozu.flywheel.event.GatherContextEvent;
|
import com.jozufozu.flywheel.event.GatherContextEvent;
|
||||||
import com.jozufozu.flywheel.util.ResourceUtil;
|
import com.jozufozu.flywheel.util.ResourceUtil;
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ import com.jozufozu.flywheel.backend.source.ShaderLoadingException;
|
||||||
import com.jozufozu.flywheel.core.pipeline.CachingCompiler;
|
import com.jozufozu.flywheel.core.pipeline.CachingCompiler;
|
||||||
import com.jozufozu.flywheel.core.pipeline.CompilationContext;
|
import com.jozufozu.flywheel.core.pipeline.CompilationContext;
|
||||||
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
|
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.WorldProgram;
|
||||||
import com.jozufozu.flywheel.core.shader.spec.ProgramSpec;
|
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Objects;
|
||||||
import com.jozufozu.flywheel.api.vertex.VertexType;
|
import com.jozufozu.flywheel.api.vertex.VertexType;
|
||||||
import com.jozufozu.flywheel.backend.RenderLayer;
|
import com.jozufozu.flywheel.backend.RenderLayer;
|
||||||
import com.jozufozu.flywheel.backend.source.SourceFile;
|
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.
|
* Represents the entire context of a program's usage.
|
||||||
|
|
|
@ -7,7 +7,6 @@ import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.ShaderContext;
|
import com.jozufozu.flywheel.backend.ShaderContext;
|
||||||
import com.jozufozu.flywheel.backend.gl.shader.GlProgram;
|
import com.jozufozu.flywheel.backend.gl.shader.GlProgram;
|
||||||
import com.jozufozu.flywheel.core.shader.extension.ExtensionInstance;
|
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jozufozu.flywheel.core.shader.extension;
|
package com.jozufozu.flywheel.core.shader;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
|
@ -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.jozufozu.flywheel.backend.GameStateRegistry;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
|
@ -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.Flywheel;
|
||||||
import com.jozufozu.flywheel.config.FlwConfig;
|
import com.jozufozu.flywheel.config.FlwConfig;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
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 NormalDebugStateProvider INSTANCE = new NormalDebugStateProvider();
|
||||||
public static final ResourceLocation NAME = Flywheel.rl("normal_debug");
|
public static final ResourceLocation NAME = Flywheel.rl("normal_debug");
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jozufozu.flywheel.core.shader.spec;
|
package com.jozufozu.flywheel.core.shader;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
|
@ -1,16 +1,15 @@
|
||||||
package com.jozufozu.flywheel.core.shader.spec;
|
package com.jozufozu.flywheel.core.shader;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.core.shader.gamestate.IGameStateProvider;
|
|
||||||
import com.jozufozu.flywheel.util.CodecUtil;
|
import com.jozufozu.flywheel.util.CodecUtil;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
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)
|
.forGetter(ProgramState::context), CodecUtil.oneOrMore(Codec.STRING)
|
||||||
.optionalFieldOf("define", Collections.emptyList())
|
.optionalFieldOf("define", Collections.emptyList())
|
||||||
.forGetter(ProgramState::defines))
|
.forGetter(ProgramState::defines))
|
|
@ -1,4 +1,4 @@
|
||||||
package com.jozufozu.flywheel.core.shader.extension;
|
package com.jozufozu.flywheel.core.shader;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL20;
|
import org.lwjgl.opengl.GL20;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import static org.lwjgl.opengl.GL20.glUniform1f;
|
||||||
import static org.lwjgl.opengl.GL20.glUniform2f;
|
import static org.lwjgl.opengl.GL20.glUniform2f;
|
||||||
import static org.lwjgl.opengl.GL20.glUniform3f;
|
import static org.lwjgl.opengl.GL20.glUniform3f;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.core.shader.extension.WorldFog;
|
|
||||||
import com.jozufozu.flywheel.util.AnimationTickHolder;
|
import com.jozufozu.flywheel.util.AnimationTickHolder;
|
||||||
import com.mojang.blaze3d.platform.Window;
|
import com.mojang.blaze3d.platform.Window;
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue