mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 23:47:09 +01:00
No more InstanceData#write
This commit is contained in:
parent
4677893690
commit
c54514cf47
5 changed files with 0 additions and 84 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<S extends InstanceData> implements StructType<S> {
|
||||
|
||||
private final NonNullSupplier<S> factory;
|
||||
private final VertexFormat format;
|
||||
|
||||
public BasicStructType(NonNullSupplier<S> 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<S> getWriter(VecBuffer backing) {
|
||||
return new BasicWriter(backing);
|
||||
}
|
||||
|
||||
public class BasicWriter implements StructWriter<S> {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<BasicData> {
|
||||
|
@ -65,8 +64,4 @@ public abstract class BasicData extends InstanceData implements IFlatLight<Basic
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(VecBuffer buf) {
|
||||
buf.putByteArray(new byte[]{blockLight, skyLight, r, g, b, a});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.jozufozu.flywheel.core.materials.model;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.core.materials.BasicData;
|
||||
import com.jozufozu.flywheel.util.WriteSafe;
|
||||
import com.jozufozu.flywheel.util.transform.Rotate;
|
||||
import com.jozufozu.flywheel.util.transform.Scale;
|
||||
import com.jozufozu.flywheel.util.transform.Translate;
|
||||
|
@ -48,13 +46,6 @@ public class ModelData extends BasicData implements Translate<ModelData>, 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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue