mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-29 08:26:37 +01:00
Nothing in particular
This commit is contained in:
parent
9a178ef9d8
commit
d58897d59a
5 changed files with 13 additions and 29 deletions
|
@ -1,9 +1,7 @@
|
|||
package com.jozufozu.flywheel.backend.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jozufozu.flywheel.backend.ShaderContext;
|
||||
|
@ -17,14 +15,12 @@ import com.jozufozu.flywheel.backend.gl.shader.IMultiProgram;
|
|||
import com.jozufozu.flywheel.backend.gl.shader.ShaderSpecLoader;
|
||||
import com.jozufozu.flywheel.backend.loading.Program;
|
||||
|
||||
public class WorldMultiProgram<P extends GlProgram> implements IMultiProgram<P> {
|
||||
public class FogMultiProgram<P extends GlProgram> implements IMultiProgram<P> {
|
||||
|
||||
private final Map<GlFogMode, P> programs;
|
||||
private final List<P> debugPrograms;
|
||||
|
||||
public WorldMultiProgram(Map<GlFogMode, P> programs, List<P> debugPrograms) {
|
||||
public FogMultiProgram(Map<GlFogMode, P> programs) {
|
||||
this.programs = programs;
|
||||
this.debugPrograms = debugPrograms;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,16 +43,6 @@ public class WorldMultiProgram<P extends GlProgram> implements IMultiProgram<P>
|
|||
|
||||
@Override
|
||||
public IMultiProgram<P> create(ShaderLoader loader, ShaderContext<P> ctx, ProgramSpec spec) {
|
||||
List<P> debugModes = new ArrayList<>(2);
|
||||
|
||||
String[] modes = new String[]{"NORMAL_DEBUG", "RAINBOW_DEBUG"};
|
||||
|
||||
for (String mode : modes) {
|
||||
Program builder = ctx.loadProgram(loader, spec, Collections.singletonList(mode));
|
||||
|
||||
debugModes.add(factory.create(builder, null));
|
||||
}
|
||||
|
||||
Map<GlFogMode, P> programs = new EnumMap<>(GlFogMode.class);
|
||||
|
||||
for (GlFogMode fogMode : GlFogMode.values()) {
|
||||
|
@ -65,7 +51,7 @@ public class WorldMultiProgram<P extends GlProgram> implements IMultiProgram<P>
|
|||
programs.put(fogMode, factory.create(builder, Collections.singletonList(fogMode)));
|
||||
}
|
||||
|
||||
return new WorldMultiProgram<>(programs, debugModes);
|
||||
return new FogMultiProgram<>(programs);
|
||||
}
|
||||
|
||||
}
|
|
@ -32,8 +32,8 @@ public class WorldContext<P extends WorldProgram> extends ShaderContext<P> {
|
|||
private static final String declaration = "#flwbuiltins";
|
||||
private static final Pattern builtinPattern = Pattern.compile(declaration);
|
||||
|
||||
public static final WorldContext<WorldProgram> INSTANCE = new WorldContext<>(new ResourceLocation(Flywheel.ID, "context/world"), new WorldMultiProgram.SpecLoader<>(WorldProgram::new));
|
||||
public static final WorldContext<CrumblingProgram> CRUMBLING = new WorldContext<>(new ResourceLocation(Flywheel.ID, "context/crumbling"), new WorldMultiProgram.SpecLoader<>(CrumblingProgram::new));
|
||||
public static final WorldContext<WorldProgram> INSTANCE = new WorldContext<>(new ResourceLocation(Flywheel.ID, "context/world"), new FogMultiProgram.SpecLoader<>(WorldProgram::new));
|
||||
public static final WorldContext<CrumblingProgram> CRUMBLING = new WorldContext<>(new ResourceLocation(Flywheel.ID, "context/crumbling"), new FogMultiProgram.SpecLoader<>(CrumblingProgram::new));
|
||||
|
||||
protected ProgramTemplate template;
|
||||
protected final ResourceLocation name;
|
||||
|
|
|
@ -57,6 +57,10 @@ public class ExtensibleGlProgram extends GlProgram {
|
|||
public interface Factory<P extends GlProgram> {
|
||||
|
||||
@Nonnull
|
||||
P create(Program program, @Nullable List<ProgramExtender> fogFactory);
|
||||
P create(Program program, @Nullable List<ProgramExtender> extensions);
|
||||
|
||||
default P create(Program program) {
|
||||
return create(program, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,5 @@ import com.jozufozu.flywheel.backend.core.shader.ProgramSpec;
|
|||
|
||||
public interface ShaderSpecLoader<P extends GlProgram> {
|
||||
|
||||
/**
|
||||
* @param loader
|
||||
* @param ctx
|
||||
* @param spec
|
||||
* @return
|
||||
*/
|
||||
IMultiProgram<P> create(ShaderLoader loader, ShaderContext<P> ctx, ProgramSpec spec);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ import java.util.stream.Stream;
|
|||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.core.FogMultiProgram;
|
||||
import com.jozufozu.flywheel.backend.core.WorldContext;
|
||||
import com.jozufozu.flywheel.backend.core.WorldMultiProgram;
|
||||
import com.jozufozu.flywheel.backend.loading.ModelTemplate;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllMovementBehaviours;
|
||||
|
@ -71,8 +71,8 @@ public class ContraptionRenderDispatcher {
|
|||
public static final Compartment<Pair<Contraption, Integer>> CONTRAPTION = new Compartment<>();
|
||||
|
||||
private static final ResourceLocation ctxRoot = new ResourceLocation("create", "context/contraption");
|
||||
public static final WorldContext<ContraptionProgram> STRUCTURE = new WorldContext<>(ctxRoot, new WorldMultiProgram.SpecLoader<>(ContraptionProgram::new), () -> Stream.of(AllProgramSpecs.STRUCTURE), ModelTemplate::new);
|
||||
public static final WorldContext<ContraptionProgram> TILES = new WorldContext<>(ctxRoot, new WorldMultiProgram.SpecLoader<>(ContraptionProgram::new));
|
||||
public static final WorldContext<ContraptionProgram> STRUCTURE = new WorldContext<>(ctxRoot, new FogMultiProgram.SpecLoader<>(ContraptionProgram::new), () -> Stream.of(AllProgramSpecs.STRUCTURE), ModelTemplate::new);
|
||||
public static final WorldContext<ContraptionProgram> TILES = new WorldContext<>(ctxRoot, new FogMultiProgram.SpecLoader<>(ContraptionProgram::new));
|
||||
|
||||
public static void tick() {
|
||||
if (Minecraft.getInstance().isGamePaused()) return;
|
||||
|
|
Loading…
Reference in a new issue