mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 12:34:11 +01:00
Models are temporary
- Add Model.delete - Allow BlockModel.createEBO to be called more than once for a single instance - Clear cache on QuadConverter.delete
This commit is contained in:
parent
98e4831b6e
commit
edd6c736cf
@ -69,7 +69,6 @@ public class GPUInstancer<D extends InstanceData> extends AbstractInstancer<D> {
|
||||
|
||||
vao = new GlVertexArray();
|
||||
|
||||
// XXX Callback seems unnecessary. Remove and extract code to run after alloc call?
|
||||
model = modelAllocator.alloc(modelData, arenaModel -> {
|
||||
// XXX VAO is bound and not reset or restored
|
||||
vao.bind();
|
||||
@ -77,7 +76,7 @@ public class GPUInstancer<D extends InstanceData> extends AbstractInstancer<D> {
|
||||
arenaModel.setupState(vao);
|
||||
});
|
||||
|
||||
// XXX VAO is already guaranteed to be bound in model callback
|
||||
// XXX VAO is bound and not reset or restored
|
||||
vao.bind();
|
||||
vao.enableArrays(model.getAttributeCount() + instanceFormat.getAttributeCount());
|
||||
|
||||
|
@ -79,6 +79,7 @@ public class QuadConverter {
|
||||
|
||||
public void delete() {
|
||||
GL32.glDeleteBuffers(ebo);
|
||||
this.cache.clear();
|
||||
this.quadCapacity = 0;
|
||||
}
|
||||
|
||||
|
@ -51,4 +51,15 @@ public class ModelPart implements Model {
|
||||
public VertexList getReader() {
|
||||
return reader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
if (reader instanceof AutoCloseable closeable) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (Exception e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,4 +47,15 @@ public class BlockModel implements Model {
|
||||
public VertexList getReader() {
|
||||
return reader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
if (reader instanceof AutoCloseable closeable) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (Exception e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ public interface Model {
|
||||
.quads2Tris(vertexCount() / 4);
|
||||
}
|
||||
|
||||
void delete();
|
||||
|
||||
/**
|
||||
* The size in bytes that this model's data takes up.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user