Compile everything on the fly

This commit is contained in:
Jozufozu 2021-12-31 12:11:30 -08:00
parent 2b6348855a
commit 0b25335f8e
7 changed files with 11 additions and 26 deletions

View file

@ -4,12 +4,12 @@ import java.util.stream.Stream;
import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.GameStateRegistry; import com.jozufozu.flywheel.backend.GameStateRegistry;
import com.jozufozu.flywheel.backend.pipeline.ShaderPipeline;
import com.jozufozu.flywheel.backend.pipeline.WorldShaderPipeline;
import com.jozufozu.flywheel.backend.source.FileResolution; import com.jozufozu.flywheel.backend.source.FileResolution;
import com.jozufozu.flywheel.backend.source.Resolver; import com.jozufozu.flywheel.backend.source.Resolver;
import com.jozufozu.flywheel.core.Templates; import com.jozufozu.flywheel.core.Templates;
import com.jozufozu.flywheel.core.WorldContext; import com.jozufozu.flywheel.core.WorldContext;
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
import com.jozufozu.flywheel.core.pipeline.WorldCompiler;
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.simibubi.create.Create; import com.simibubi.create.Create;
@ -32,8 +32,8 @@ public class CreateContexts {
GameStateRegistry.register(RainbowDebugStateProvider.INSTANCE); GameStateRegistry.register(RainbowDebugStateProvider.INSTANCE);
FileResolution header = Resolver.INSTANCE.findShader(ResourceUtil.subPath(CONTRAPTION, ".glsl")); FileResolution header = Resolver.INSTANCE.findShader(ResourceUtil.subPath(CONTRAPTION, ".glsl"));
ShaderPipeline<ContraptionProgram> instancing = new WorldShaderPipeline<>(ContraptionProgram::new, Templates.INSTANCING, header); PipelineCompiler<ContraptionProgram> instancing = new WorldCompiler<>(ContraptionProgram::new, Templates.INSTANCING, header);
ShaderPipeline<ContraptionProgram> structure = new WorldShaderPipeline<>(ContraptionProgram::new, Templates.ONE_SHOT, header); PipelineCompiler<ContraptionProgram> structure = new WorldCompiler<>(ContraptionProgram::new, Templates.ONE_SHOT, header);
CWORLD = backend.register(WorldContext.builder(backend, CONTRAPTION) CWORLD = backend.register(WorldContext.builder(backend, CONTRAPTION)
.build(instancing)); .build(instancing));

View file

@ -1,12 +1,12 @@
package com.simibubi.create.foundation.render; package com.simibubi.create.foundation.render;
import com.jozufozu.flywheel.core.shader.spec.BooleanStateProvider; import com.jozufozu.flywheel.core.shader.gamestate.IGameStateProvider;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.KineticDebugger; import com.simibubi.create.content.contraptions.KineticDebugger;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
public class RainbowDebugStateProvider implements BooleanStateProvider { public class RainbowDebugStateProvider implements IGameStateProvider {
public static final RainbowDebugStateProvider INSTANCE = new RainbowDebugStateProvider(); public static final RainbowDebugStateProvider INSTANCE = new RainbowDebugStateProvider();
public static final ResourceLocation NAME = Create.asResource("rainbow_debug"); public static final ResourceLocation NAME = Create.asResource("rainbow_debug");

View file

@ -6,10 +6,7 @@
"define": "DEBUG_RAINBOW" "define": "DEBUG_RAINBOW"
}, },
{ {
"when": { "when": "flywheel:normal_debug",
"provider": "flywheel:normal_debug",
"value": "true"
},
"define": "DEBUG_NORMAL" "define": "DEBUG_NORMAL"
} }
] ]

View file

@ -2,10 +2,7 @@
"source": "create:contraption_actor.vert", "source": "create:contraption_actor.vert",
"states": [ "states": [
{ {
"when": { "when": "flywheel:normal_debug",
"provider": "flywheel:normal_debug",
"value": "true"
},
"define": "DEBUG_NORMAL" "define": "DEBUG_NORMAL"
} }
] ]

View file

@ -2,10 +2,7 @@
"source": "create:flap.vert", "source": "create:flap.vert",
"states": [ "states": [
{ {
"when": { "when": "flywheel:normal_debug",
"provider": "flywheel:normal_debug",
"value": "true"
},
"define": "DEBUG_NORMAL" "define": "DEBUG_NORMAL"
} }
] ]

View file

@ -2,10 +2,7 @@
"source": "create:passthru.vert", "source": "create:passthru.vert",
"states": [ "states": [
{ {
"when": { "when": "flywheel:normal_debug",
"provider": "flywheel:normal_debug",
"value": "true"
},
"define": "DEBUG_NORMAL" "define": "DEBUG_NORMAL"
} }
] ]

View file

@ -6,10 +6,7 @@
"define": "DEBUG_RAINBOW" "define": "DEBUG_RAINBOW"
}, },
{ {
"when": { "when": "flywheel:normal_debug",
"provider": "flywheel:normal_debug",
"value": "true"
},
"define": "DEBUG_NORMAL" "define": "DEBUG_NORMAL"
} }
] ]