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.embeddedt.embeddium.impl.gl.util.EnumBitField;
|
||||||
import org.lwjgl.opengl.*;
|
import org.lwjgl.opengl.*;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
public class GLRenderDevice implements RenderDevice {
|
public class GLRenderDevice implements RenderDevice {
|
||||||
private final GlStateTracker stateTracker = new GlStateTracker();
|
private final GlStateTracker stateTracker = new GlStateTracker();
|
||||||
@@ -24,6 +25,7 @@ public class GLRenderDevice implements RenderDevice {
|
|||||||
public static Runnable VANILLA_STATE_RESETTER = () -> {
|
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.");
|
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
|
@Override
|
||||||
public CommandList createCommandList() {
|
public CommandList createCommandList() {
|
||||||
@@ -257,7 +259,7 @@ public class GLRenderDevice implements RenderDevice {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GlTessellation createTessellation(TessellationBinding[] bindings) {
|
public GlTessellation createTessellation(TessellationBinding[] bindings) {
|
||||||
GlVertexArrayTessellation tessellation = new GlVertexArrayTessellation(new GlVertexArray(), bindings);
|
GlAbstractTessellation tessellation = GL_TESSELLATION_PROVIDER.apply(new GlVertexArray(), bindings);
|
||||||
tessellation.init(this);
|
tessellation.init(this);
|
||||||
|
|
||||||
return tessellation;
|
return tessellation;
|
||||||
|
|||||||
+4
@@ -12,6 +12,10 @@ public abstract class GlAbstractTessellation implements GlTessellation {
|
|||||||
this.bindings = bindings;
|
this.bindings = bindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void init(CommandList commandList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void bindAttributes(CommandList commandList) {
|
protected void bindAttributes(CommandList commandList) {
|
||||||
for (TessellationBinding binding : this.bindings) {
|
for (TessellationBinding binding : this.bindings) {
|
||||||
commandList.bindBuffer(binding.target(), binding.buffer());
|
commandList.bindBuffer(binding.target(), binding.buffer());
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ public class GlVertexArrayTessellation extends GlAbstractTessellation {
|
|||||||
this.array = array;
|
this.array = array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void init(CommandList commandList) {
|
public void init(CommandList commandList) {
|
||||||
this.bind(commandList);
|
this.bind(commandList);
|
||||||
this.bindAttributes(commandList);
|
this.bindAttributes(commandList);
|
||||||
|
|||||||
Reference in new issue
Block a user