Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ dependencies {
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Avaritia:1.78:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Avaritiaddons:1.9.3-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
runtimeOnlyNonPublishable('com.github.GTNewHorizons:EnderIO:2.10.8:dev')
// runtimeOnlyNonPublishable('com.github.GTNewHorizons:EnderIO:2.10.8:dev')
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderStorage:1.8.0:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.140:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:FloodLights:1.5.5:dev")
Expand All @@ -95,8 +95,6 @@ dependencies {

testImplementation(platform('org.junit:junit-bom:5.9.2'))
testImplementation('org.junit.jupiter:junit-jupiter')

runtimeOnlyNonPublishable(rfg.deobf("curse.maven:spark-361579:4271867"))
}

// deps may transitively add Baubles, so we replace it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class BoxRenderer {
private final ShaderProgram program;
private final int time_location;

private final VertexBuffer buffer = new VertexBuffer(DefaultVertexFormat.POSITION_COLOR_TEXTURE, GL11.GL_QUADS);

public BoxRenderer() {
program = new ShaderProgram(
Mods.MatterManipulator.resourceDomain,
Expand All @@ -39,8 +41,6 @@ public BoxRenderer() {

/**
* Starts rendering fancy boxes. Should only be called once per frame, to allow quad sorting.
*
* @param partialTickTime
*/
public void start(double partialTickTime) {
TessellatorManager.startCapturing();
Expand Down Expand Up @@ -163,13 +163,10 @@ public void finish() {

program.use();

// this should only be done once a frame, but there aren't any side effects from calling it more
GL20.glUniform1f(time_location, (((float) (System.currentTimeMillis() % 2500)) / 1000f));

try (VertexBuffer buffer = new VertexBuffer(DefaultVertexFormat.POSITION_COLOR_TEXTURE, GL11.GL_QUADS);) {
buffer.upload(bytes);
buffer.render();
}
buffer.upload(bytes);
buffer.render();

ShaderProgram.clear();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.recursive_pineapple.matter_manipulator.common.items.manipulator;

import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFormat;

import org.intellij.lang.annotations.MagicConstant;
import org.lwjgl.opengl.ARBBufferStorage;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL30;

/// Note: this doesn't work properly for some reason, don't use it as-is
public class FixedLengthVertexBuffer extends StreamingVertexBuffer {

public FixedLengthVertexBuffer(VertexFormat format, int drawMode) {
super(format, drawMode);
}

@Override
public void reallocate() {
generate();

// noinspection MagicConstant
setSize(this.length, this.bufferFlags);
}

@Override
public void allocate(
int vertexCount,
@MagicConstant(intValues = {
ARBBufferStorage.GL_DYNAMIC_STORAGE_BIT,
GL30.GL_MAP_READ_BIT,
GL30.GL_MAP_WRITE_BIT,
ARBBufferStorage.GL_MAP_PERSISTENT_BIT,
ARBBufferStorage.GL_MAP_COHERENT_BIT,
ARBBufferStorage.GL_CLIENT_STORAGE_BIT,
}) int usage
) {
// noinspection MagicConstant
if (this.id == 0 || vertexCount < this.vertexCount / 4 || vertexCount > this.vertexCount || usage != this.bufferFlags) {
generate();

setSize(vertexCount * (long) format.getVertexSize(), usage);
}

this.vertexCount = vertexCount;
}

public void setSize(
long length,
@MagicConstant(intValues = {
ARBBufferStorage.GL_DYNAMIC_STORAGE_BIT,
GL30.GL_MAP_READ_BIT,
GL30.GL_MAP_WRITE_BIT,
ARBBufferStorage.GL_MAP_PERSISTENT_BIT,
ARBBufferStorage.GL_MAP_COHERENT_BIT,
ARBBufferStorage.GL_CLIENT_STORAGE_BIT,
}) int bufferFlags
) {
if (this.length > 0) throw new IllegalStateException("Cannot resize an immutable (fixed length) vertex buffer");

bind();

this.length = length;
this.bufferFlags = bufferFlags;
ARBBufferStorage.glBufferStorage(GL15.GL_ARRAY_BUFFER, length, bufferFlags);

unbind();
}

public void flush() {
bind();
GL30.glFlushMappedBufferRange(GL15.GL_ARRAY_BUFFER, 0, vertexCount * (long) format.getVertexSize());
unbind();
}

public void flushAll() {
bind();
GL30.glFlushMappedBufferRange(GL15.GL_ARRAY_BUFFER, 0, length);
unbind();
}
}
Loading