mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-28 22:05:01 +01:00
A heck of a lot
- Reorganize everything - Isolate SourceFile related things - Should consider decoupling ShaderLoader from resource loading - Document a lot of newer things - Index functions - Awkward WorldContext builder - Template responsible for providing shader inputs - Template is now an abstract class - Template provides GLSL version - ProgramSpecs now only accept one file
This commit is contained in:
parent
cb47ca8452
commit
208c6eff89
6 changed files with 15 additions and 25 deletions
|
@ -2,14 +2,11 @@ package com.simibubi.create.foundation.render;
|
|||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.lwjgl.opengl.GL46;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.FileResolution;
|
||||
import com.jozufozu.flywheel.backend.source.FileResolution;
|
||||
import com.jozufozu.flywheel.backend.ResourceUtil;
|
||||
import com.jozufozu.flywheel.backend.SpecMetaRegistry;
|
||||
import com.jozufozu.flywheel.backend.pipeline.IShaderPipeline;
|
||||
import com.jozufozu.flywheel.backend.pipeline.ITemplate;
|
||||
import com.jozufozu.flywheel.backend.pipeline.InstancingTemplate;
|
||||
import com.jozufozu.flywheel.backend.pipeline.OneShotTemplate;
|
||||
import com.jozufozu.flywheel.backend.pipeline.WorldShaderPipeline;
|
||||
|
@ -32,19 +29,17 @@ public class CreateContexts {
|
|||
Backend backend = event.getBackend();
|
||||
|
||||
SpecMetaRegistry.register(RainbowDebugStateProvider.INSTANCE);
|
||||
|
||||
CWORLD = backend.register(contraptionContext(backend, InstancingTemplate.INSTANCE));
|
||||
STRUCTURE = backend.register(contraptionContext(backend, OneShotTemplate.INSTANCE)
|
||||
.withSpecStream(() -> Stream.of(AllProgramSpecs.STRUCTURE)));
|
||||
}
|
||||
|
||||
private static WorldContext<ContraptionProgram> contraptionContext(Backend backend, ITemplate template) {
|
||||
|
||||
FileResolution header = backend.sources.resolveFile(ResourceUtil.subPath(CONTRAPTION, ".glsl"));
|
||||
|
||||
IShaderPipeline<ContraptionProgram> worldPipeline = new WorldShaderPipeline<>(backend.sources, ContraptionProgram::new, template, header);
|
||||
IShaderPipeline<ContraptionProgram> instancing = new WorldShaderPipeline<>(backend.sources, ContraptionProgram::new, InstancingTemplate.INSTANCE, header);
|
||||
IShaderPipeline<ContraptionProgram> structure = new WorldShaderPipeline<>(backend.sources, ContraptionProgram::new, OneShotTemplate.INSTANCE, header);
|
||||
|
||||
return new WorldContext<>(backend, worldPipeline)
|
||||
.withName(CONTRAPTION);
|
||||
CWORLD = backend.register(WorldContext.builder(backend, CONTRAPTION)
|
||||
.build(instancing));
|
||||
|
||||
STRUCTURE = backend.register(WorldContext.builder(backend, CONTRAPTION)
|
||||
.setSpecStream(() -> Stream.of(AllProgramSpecs.STRUCTURE))
|
||||
.build(structure));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"vert": "create:belt.vert",
|
||||
"frag": "flywheel:block.frag",
|
||||
"source": "create:belt.vert",
|
||||
"states": [
|
||||
{
|
||||
"when": "create:rainbow_debug",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"vert": "create:contraption_actor.vert",
|
||||
"frag": "flywheel:block.frag",
|
||||
"source": "create:contraption_actor.vert",
|
||||
"states": [
|
||||
{
|
||||
"when": {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"vert": "create:contraption_structure.vert",
|
||||
"frag": "flywheel:block.frag",
|
||||
"source": "create:contraption_structure.vert",
|
||||
"states": [
|
||||
{
|
||||
"when": {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"vert": "create:flap.vert",
|
||||
"frag": "flywheel:block.frag",
|
||||
"source": "create:flap.vert",
|
||||
"states": [
|
||||
{
|
||||
"when": {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"vert": "create:rotating.vert",
|
||||
"frag": "flywheel:block.frag",
|
||||
"source": "create:rotating.vert",
|
||||
"states": [
|
||||
{
|
||||
"when": "create:rainbow_debug",
|
||||
|
|
Loading…
Reference in a new issue