mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Almost sane shaders
- No more ShaderContext. Programs are directly retrieved through ProgramCompilers. - Templates don't need generics - Remove ExtensibleGlProgram
This commit is contained in:
parent
2856594cc8
commit
9f64ae4e9a
5 changed files with 9 additions and 39 deletions
|
@ -9,11 +9,12 @@ import com.jozufozu.flywheel.backend.gl.GlStateTracker;
|
|||
import com.jozufozu.flywheel.backend.gl.GlTextureUnit;
|
||||
import com.jozufozu.flywheel.backend.gl.GlVertexArray;
|
||||
import com.jozufozu.flywheel.core.Formats;
|
||||
import com.jozufozu.flywheel.core.Materials;
|
||||
import com.jozufozu.flywheel.core.compile.ProgramContext;
|
||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||
import com.jozufozu.flywheel.event.RenderLayerEvent;
|
||||
import com.jozufozu.flywheel.util.Textures;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||
import com.simibubi.create.foundation.render.CreateContexts;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
@ -49,7 +50,7 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
|
|||
|
||||
Textures.bindActiveTextures();
|
||||
|
||||
ContraptionProgram structureShader = CreateContexts.STRUCTURE.getProgram(AllProgramSpecs.PASSTHRU, Formats.BLOCK, RenderLayer.CUTOUT);
|
||||
ContraptionProgram structureShader = CreateContexts.STRUCTURE.getProgram(ProgramContext.create(Materials.Names.PASSTHRU, Formats.BLOCK, event.getLayer()));
|
||||
|
||||
structureShader.bind();
|
||||
structureShader.uploadViewProjection(event.viewProjection);
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.resources.ResourceLocation;
|
|||
|
||||
public class AllProgramSpecs {
|
||||
|
||||
public static final ResourceLocation PASSTHRU = asResource("passthru");
|
||||
public static final ResourceLocation ROTATING = asResource("rotating");
|
||||
public static final ResourceLocation CHROMATIC = asResource("chromatic");
|
||||
public static final ResourceLocation BELT = asResource("belt");
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.GameStateRegistry;
|
||||
import com.jozufozu.flywheel.backend.source.FileResolution;
|
||||
import com.jozufozu.flywheel.backend.source.Resolver;
|
||||
import com.jozufozu.flywheel.core.Templates;
|
||||
import com.jozufozu.flywheel.core.WorldContext;
|
||||
import com.jozufozu.flywheel.core.pipeline.PipelineCompiler;
|
||||
import com.jozufozu.flywheel.core.pipeline.WorldCompiler;
|
||||
import com.jozufozu.flywheel.core.compile.ProgramCompiler;
|
||||
import com.jozufozu.flywheel.event.GatherContextEvent;
|
||||
import com.jozufozu.flywheel.util.ResourceUtil;
|
||||
import com.simibubi.create.Create;
|
||||
|
@ -23,24 +18,15 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
public class CreateContexts {
|
||||
private static final ResourceLocation CONTRAPTION = Create.asResource("context/contraption");
|
||||
|
||||
public static WorldContext<ContraptionProgram> CWORLD;
|
||||
public static WorldContext<ContraptionProgram> STRUCTURE;
|
||||
public static ProgramCompiler<ContraptionProgram> CWORLD;
|
||||
public static ProgramCompiler<ContraptionProgram> STRUCTURE;
|
||||
|
||||
public static void flwInit(GatherContextEvent event) {
|
||||
Backend backend = event.getBackend();
|
||||
|
||||
GameStateRegistry.register(RainbowDebugStateProvider.INSTANCE);
|
||||
FileResolution header = Resolver.INSTANCE.findShader(ResourceUtil.subPath(CONTRAPTION, ".glsl"));
|
||||
FileResolution header = Resolver.INSTANCE.get(ResourceUtil.subPath(CONTRAPTION, ".glsl"));
|
||||
|
||||
PipelineCompiler<ContraptionProgram> instancing = new WorldCompiler<>(ContraptionProgram::new, Templates.INSTANCING, header);
|
||||
PipelineCompiler<ContraptionProgram> structure = new WorldCompiler<>(ContraptionProgram::new, Templates.ONE_SHOT, header);
|
||||
|
||||
CWORLD = backend.register(WorldContext.builder(backend, CONTRAPTION)
|
||||
.build(instancing));
|
||||
|
||||
STRUCTURE = backend.register(WorldContext.builder(backend, CONTRAPTION)
|
||||
.setSpecStream(() -> Stream.of(AllProgramSpecs.PASSTHRU))
|
||||
.build(structure));
|
||||
CWORLD = Templates.INSTANCING.programCompiler(ContraptionProgram::new, header);
|
||||
STRUCTURE = Templates.ONE_SHOT.programCompiler(ContraptionProgram::new, header);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"source": "create:passthru.vert",
|
||||
"states": [
|
||||
{
|
||||
"when": "flywheel:normal_debug",
|
||||
"define": "DEBUG_NORMAL"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#use "flywheel:block.frag"
|
||||
|
||||
#if defined(VERTEX_SHADER)
|
||||
void vertex(inout Vertex v) {
|
||||
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue