From c54514cf47f702cb6d1c5c7df444c0b4702dfc40 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 2 Dec 2021 20:13:55 -0800 Subject: [PATCH] No more InstanceData#write --- .../backend/instancing/InstanceData.java | 4 -- .../backend/struct/BasicStructType.java | 50 ------------------- .../flywheel/core/materials/BasicData.java | 5 -- .../core/materials/model/ModelData.java | 9 ---- .../core/materials/oriented/OrientedData.java | 16 ------ 5 files changed, 84 deletions(-) delete mode 100644 src/main/java/com/jozufozu/flywheel/backend/struct/BasicStructType.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceData.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceData.java index 125ddbdeb..5379822de 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceData.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceData.java @@ -1,7 +1,5 @@ package com.jozufozu.flywheel.backend.instancing; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; - public abstract class InstanceData { Instancer owner; @@ -9,8 +7,6 @@ public abstract class InstanceData { boolean dirty; boolean removed; - public abstract void write(VecBuffer buf); - public void markDirty() { owner.markDirty(this); } diff --git a/src/main/java/com/jozufozu/flywheel/backend/struct/BasicStructType.java b/src/main/java/com/jozufozu/flywheel/backend/struct/BasicStructType.java deleted file mode 100644 index eaa9eaa3d..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/struct/BasicStructType.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.jozufozu.flywheel.backend.struct; - -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; -import com.jozufozu.flywheel.backend.instancing.InstanceData; -import com.jozufozu.flywheel.util.NonNullSupplier; - -public class BasicStructType implements StructType { - - private final NonNullSupplier factory; - private final VertexFormat format; - - public BasicStructType(NonNullSupplier factory, VertexFormat format) { - this.factory = factory; - this.format = format; - } - - @Override - public S create() { - return factory.get(); - } - - @Override - public VertexFormat format() { - return format; - } - - @Override - public StructWriter getWriter(VecBuffer backing) { - return new BasicWriter(backing); - } - - public class BasicWriter implements StructWriter { - private final VecBuffer buffer; - - public BasicWriter(VecBuffer buffer) { - this.buffer = buffer; - } - - @Override - public void write(S struct) { - struct.write(buffer); - } - - @Override - public void seek(int pos) { - buffer.position(pos * format.getStride()); - } - } -} diff --git a/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java b/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java index 3434b5284..eed1208bd 100644 --- a/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java +++ b/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java @@ -1,6 +1,5 @@ package com.jozufozu.flywheel.core.materials; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.instancing.InstanceData; public abstract class BasicData extends InstanceData implements IFlatLight { @@ -65,8 +64,4 @@ public abstract class BasicData extends InstanceData implements IFlatLight, Rotate return this; } - @Override - public void write(VecBuffer buf) { - super.write(buf); - ((WriteSafe) (Object) model).write(buf); - ((WriteSafe) (Object) normal).write(buf); - } - @Override public ModelData multiply(Quaternion quaternion) { markDirty(); diff --git a/src/main/java/com/jozufozu/flywheel/core/materials/oriented/OrientedData.java b/src/main/java/com/jozufozu/flywheel/core/materials/oriented/OrientedData.java index 850b426a3..d819870f2 100644 --- a/src/main/java/com/jozufozu/flywheel/core/materials/oriented/OrientedData.java +++ b/src/main/java/com/jozufozu/flywheel/core/materials/oriented/OrientedData.java @@ -1,6 +1,5 @@ package com.jozufozu.flywheel.core.materials.oriented; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.materials.BasicData; import com.jozufozu.flywheel.util.vec.Vec3; import com.mojang.math.Quaternion; @@ -92,20 +91,5 @@ public class OrientedData extends BasicData { return this; } - @Override - public void write(VecBuffer buf) { - super.write(buf); - - buf.putFloat(posX); - buf.putFloat(posY); - buf.putFloat(posZ); - buf.putFloat(pivotX); - buf.putFloat(pivotY); - buf.putFloat(pivotZ); - buf.putFloat(qX); - buf.putFloat(qY); - buf.putFloat(qZ); - buf.putFloat(qW); - } }