Allow for custom GlAbstractTessellation implementations #15
No files matched your search
@@ -9,6 +9,7 @@ import org.embeddedt.embeddium.impl.gl.tessellation.*;
|
||||
import org.embeddedt.embeddium.impl.gl.util.EnumBitField;
|
||||
import org.lwjgl.opengl.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class GLRenderDevice implements RenderDevice {
|
||||
private final GlStateTracker stateTracker = new GlStateTracker();
|
||||
@@ -24,6 +25,7 @@ public class GLRenderDevice implements RenderDevice {
|
||||
public static Runnable VANILLA_STATE_RESETTER = () -> {
|
||||
throw new IllegalStateException("The host mod should replace the VANILLA_STATE_RESETTER with an implementation specific to the platform.");
|
||||
};
|
||||
public static BiFunction<GlVertexArray, TessellationBinding[], GlAbstractTessellation> GL_TESSELLATION_PROVIDER = GlVertexArrayTessellation::new;
|
||||
|
||||
@Override
|
||||
public CommandList createCommandList() {
|
||||
@@ -257,7 +259,7 @@ public class GLRenderDevice implements RenderDevice {
|
||||
|
||||
@Override
|
||||
public GlTessellation createTessellation(TessellationBinding[] bindings) {
|
||||
GlVertexArrayTessellation tessellation = new GlVertexArrayTessellation(new GlVertexArray(), bindings);
|
||||
GlAbstractTessellation tessellation = GL_TESSELLATION_PROVIDER.apply(new GlVertexArray(), bindings);
|
||||
tessellation.init(this);
|
||||
|
||||
return tessellation;
|
||||
|
||||
+4
@@ -12,6 +12,10 @@ public abstract class GlAbstractTessellation implements GlTessellation {
|
||||
this.bindings = bindings;
|
||||
}
|
||||
|
||||
public void init(CommandList commandList) {
|
||||
|
||||
}
|
||||
|
||||
protected void bindAttributes(CommandList commandList) {
|
||||
for (TessellationBinding binding : this.bindings) {
|
||||
commandList.bindBuffer(binding.target(), binding.buffer());
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ public class GlVertexArrayTessellation extends GlAbstractTessellation {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(CommandList commandList) {
|
||||
this.bind(commandList);
|
||||
this.bindAttributes(commandList);
|
||||
|
||||
Reference in new issue
Block a user