diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java index 5356f0306..2a1e7ae85 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base.flwdata; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.core.layout.BufferLayout; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.ModelTransformer; import com.jozufozu.flywheel.util.RenderMath; @@ -22,13 +22,13 @@ public class BeltType implements Instanced, Batched { } @Override - public VertexFormat format() { + public BufferLayout getLayout() { return AllInstanceFormats.BELT; } @Override public StructWriter getWriter(VecBuffer backing) { - return new UnsafeBeltWriter(backing, this); + return new BeltWriterUnsafe(backing, this); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltWriterUnsafe.java similarity index 87% rename from src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java rename to src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltWriterUnsafe.java index 59ba5203f..1cf570be5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltWriterUnsafe.java @@ -5,8 +5,8 @@ import org.lwjgl.system.MemoryUtil; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; -public class UnsafeBeltWriter extends UnsafeKineticWriter { - public UnsafeBeltWriter(VecBuffer backingBuffer, StructType vertexType) { +public class BeltWriterUnsafe extends KineticWriterUnsafe { + public BeltWriterUnsafe(VecBuffer backingBuffer, StructType vertexType) { super(backingBuffer, vertexType); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeKineticWriter.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/KineticWriterUnsafe.java similarity index 73% rename from src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeKineticWriter.java rename to src/main/java/com/simibubi/create/content/contraptions/base/flwdata/KineticWriterUnsafe.java index f6fbeebfc..d450b1d6a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeKineticWriter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/KineticWriterUnsafe.java @@ -4,10 +4,10 @@ import org.lwjgl.system.MemoryUtil; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; -import com.jozufozu.flywheel.core.materials.UnsafeBasicWriter; +import com.jozufozu.flywheel.core.materials.BasicWriterUnsafe; -public abstract class UnsafeKineticWriter extends UnsafeBasicWriter { - public UnsafeKineticWriter(VecBuffer backingBuffer, StructType vertexType) { +public abstract class KineticWriterUnsafe extends BasicWriterUnsafe { + public KineticWriterUnsafe(VecBuffer backingBuffer, StructType vertexType) { super(backingBuffer, vertexType); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java index fd1f444b5..84e8f5d9a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base.flwdata; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.core.layout.BufferLayout; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.ModelTransformer; import com.jozufozu.flywheel.util.RenderMath; @@ -22,13 +22,13 @@ public class RotatingType implements Instanced, Batched getWriter(VecBuffer backing) { - return new UnsafeRotatingWriter(backing, this); + return new RotatingWriterUnsafe(backing, this); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingWriterUnsafe.java similarity index 81% rename from src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java rename to src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingWriterUnsafe.java index b477c8e20..b57e21d2a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingWriterUnsafe.java @@ -5,8 +5,8 @@ import org.lwjgl.system.MemoryUtil; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; -public class UnsafeRotatingWriter extends UnsafeKineticWriter { - public UnsafeRotatingWriter(VecBuffer backingBuffer, StructType vertexType) { +public class RotatingWriterUnsafe extends KineticWriterUnsafe { + public RotatingWriterUnsafe(VecBuffer backingBuffer, StructType vertexType) { super(backingBuffer, vertexType); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java index 8978472ae..ad55be8cc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.core.layout.BufferLayout; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.ModelTransformer; import com.simibubi.create.foundation.render.AllInstanceFormats; @@ -18,7 +18,7 @@ public class ActorType implements Instanced, Batched { } @Override - public VertexFormat format() { + public BufferLayout getLayout() { return AllInstanceFormats.ACTOR; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueModel.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueModel.java index c5530c8b1..0c8cd46df 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueModel.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.glue; +import com.jozufozu.flywheel.core.Formats; import com.jozufozu.flywheel.core.model.Model; -import com.jozufozu.flywheel.core.vertex.PosTexNormalVertexListUnsafe; -import com.jozufozu.flywheel.core.vertex.PosTexNormalWriter; -import com.jozufozu.flywheel.core.vertex.VertexList; +import com.jozufozu.flywheel.core.vertex.PosTexNormalWriterUnsafe; +import com.jozufozu.flywheel.api.vertex.VertexList; import com.mojang.blaze3d.platform.MemoryTracker; import com.simibubi.create.AllStitchedTextures; import com.simibubi.create.foundation.utility.VecHelper; @@ -21,10 +21,10 @@ public class GlueModel implements Model { return INSTANCE; } - private final PosTexNormalVertexListUnsafe reader; + private final VertexList reader; private GlueModel() { - PosTexNormalWriter writer = new PosTexNormalWriter(MemoryTracker.create(size())); + PosTexNormalWriterUnsafe writer = Formats.POS_TEX_NORMAL.createWriter(MemoryTracker.create(size())); createGlueModel(writer); reader = writer.intoReader(); } @@ -44,7 +44,7 @@ public class GlueModel implements Model { return reader; } - public static void createGlueModel(PosTexNormalWriter buffer) { + public static void createGlueModel(PosTexNormalWriterUnsafe buffer) { Vec3 diff = Vec3.atLowerCornerOf(Direction.SOUTH.getNormal()); Vec3 extension = diff.normalize() .scale(1 / 32f - 1 / 128f); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java index 8eecc5662..5e1696ad9 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.block.flap; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.core.layout.BufferLayout; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.ModelTransformer; import com.simibubi.create.foundation.render.AllInstanceFormats; @@ -18,7 +18,7 @@ public class FlapType implements Instanced, Batched { } @Override - public VertexFormat format() { + public BufferLayout getLayout() { return AllInstanceFormats.FLAP; } diff --git a/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java b/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java index e0ecfaefa..95a76206c 100644 --- a/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java +++ b/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java @@ -1,33 +1,33 @@ package com.simibubi.create.foundation.render; -import com.jozufozu.flywheel.backend.gl.attrib.CommonAttributes; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.core.layout.CommonItems; +import com.jozufozu.flywheel.core.layout.BufferLayout; public class AllInstanceFormats { - public static VertexFormat ROTATING = kineticInstance() - .addAttributes(CommonAttributes.NORMAL) + public static BufferLayout ROTATING = kineticInstance() + .addItems(CommonItems.NORMAL) .build(); - public static VertexFormat BELT = kineticInstance() - .addAttributes(CommonAttributes.QUATERNION, CommonAttributes.UV, CommonAttributes.VEC4, - CommonAttributes.NORMALIZED_BYTE) + public static BufferLayout BELT = kineticInstance() + .addItems(CommonItems.QUATERNION, CommonItems.UV, CommonItems.VEC4, + CommonItems.NORMALIZED_BYTE) .build(); - public static VertexFormat ACTOR = VertexFormat.builder() - .addAttributes(CommonAttributes.VEC3, CommonAttributes.LIGHT, CommonAttributes.FLOAT, - CommonAttributes.NORMAL, CommonAttributes.QUATERNION, CommonAttributes.NORMAL, - CommonAttributes.FLOAT) + public static BufferLayout ACTOR = BufferLayout.builder() + .addItems(CommonItems.VEC3, CommonItems.LIGHT, CommonItems.FLOAT, + CommonItems.NORMAL, CommonItems.QUATERNION, CommonItems.NORMAL, + CommonItems.FLOAT) .build(); - public static VertexFormat FLAP = VertexFormat.builder() - .addAttributes(CommonAttributes.VEC3, CommonAttributes.LIGHT, CommonAttributes.VEC3, CommonAttributes.VEC3, - CommonAttributes.FLOAT, CommonAttributes.FLOAT, CommonAttributes.FLOAT, CommonAttributes.FLOAT) + public static BufferLayout FLAP = BufferLayout.builder() + .addItems(CommonItems.VEC3, CommonItems.LIGHT, CommonItems.VEC3, CommonItems.VEC3, + CommonItems.FLOAT, CommonItems.FLOAT, CommonItems.FLOAT, CommonItems.FLOAT) .build(); - private static VertexFormat.Builder kineticInstance() { - return VertexFormat.builder() - .addAttributes(CommonAttributes.LIGHT, CommonAttributes.RGBA) - .addAttributes(CommonAttributes.VEC3, CommonAttributes.FLOAT, CommonAttributes.FLOAT); + private static BufferLayout.Builder kineticInstance() { + return BufferLayout.builder() + .addItems(CommonItems.LIGHT, CommonItems.RGBA) + .addItems(CommonItems.VEC3, CommonItems.FLOAT, CommonItems.FLOAT); } } diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java index b06ee41ae..a8628aa59 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -1,7 +1,7 @@ package com.simibubi.create.foundation.render; import com.jozufozu.flywheel.core.vertex.BlockVertexList; -import com.jozufozu.flywheel.core.vertex.VertexList; +import com.jozufozu.flywheel.api.vertex.VertexList; import com.jozufozu.flywheel.util.transform.Rotate; import com.jozufozu.flywheel.util.transform.Scale; import com.jozufozu.flywheel.util.transform.TStack; diff --git a/src/main/resources/assets/create/flywheel/shaders/contraption_structure.vert b/src/main/resources/assets/create/flywheel/shaders/contraption_structure.vert index 66db67682..2460a76fc 100644 --- a/src/main/resources/assets/create/flywheel/shaders/contraption_structure.vert +++ b/src/main/resources/assets/create/flywheel/shaders/contraption_structure.vert @@ -5,10 +5,10 @@ struct Vertex { vec3 pos; - vec3 normal; - vec2 texCoords; vec4 color; + vec2 texCoords; vec2 modelLight; + vec3 normal; }; #use "flywheel:block.frag"