slightly faster bilinear interpolation #33
No files matched your search
+2
@@ -32,7 +32,9 @@ public class ChunkMeshBufferBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void push(ChunkVertexEncoder.Vertex[] vertices, Material material) {
|
public void push(ChunkVertexEncoder.Vertex[] vertices, Material material) {
|
||||||
|
if (this.encoder.supportsBilinearCorrection()) {
|
||||||
postprocessVertices(vertices);
|
postprocessVertices(vertices);
|
||||||
|
}
|
||||||
|
|
||||||
var vertexStart = this.count * this.stride;
|
var vertexStart = this.count * this.stride;
|
||||||
var vertexSize = vertices.length * this.stride;
|
var vertexSize = vertices.length * this.stride;
|
||||||
|
|||||||
+4
@@ -5,6 +5,10 @@ import org.embeddedt.embeddium.impl.render.chunk.terrain.material.Material;
|
|||||||
public interface ChunkVertexEncoder {
|
public interface ChunkVertexEncoder {
|
||||||
long write(long ptr, Material material, Vertex vertex, int sectionIndex);
|
long write(long ptr, Material material, Vertex vertex, int sectionIndex);
|
||||||
|
|
||||||
|
default boolean supportsBilinearCorrection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
class Vertex {
|
class Vertex {
|
||||||
public float x;
|
public float x;
|
||||||
public float y;
|
public float y;
|
||||||
|
|||||||
+6
@@ -144,6 +144,11 @@ public class XHFPTerrainVertex implements ChunkVertexEncoder, ContextAwareChunkV
|
|||||||
this.ignoreMidBlock = false;
|
this.ignoreMidBlock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsBilinearCorrection() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long write(long ptr,
|
public long write(long ptr,
|
||||||
Material material, Vertex vertex, int chunkId) {
|
Material material, Vertex vertex, int chunkId) {
|
||||||
@@ -151,6 +156,7 @@ public class XHFPTerrainVertex implements ChunkVertexEncoder, ContextAwareChunkV
|
|||||||
vSum += vertex.v;
|
vSum += vertex.v;
|
||||||
vertexCount++;
|
vertexCount++;
|
||||||
|
|
||||||
|
vertex.rdhFactor = 0;
|
||||||
this.baseEncoder.write(ptr, material, vertex, chunkId);
|
this.baseEncoder.write(ptr, material, vertex, chunkId);
|
||||||
|
|
||||||
MemoryUtil.memPutShort(ptr + MC_ENTITY_OFFSET + 2, renderType);
|
MemoryUtil.memPutShort(ptr + MC_ENTITY_OFFSET + 2, renderType);
|
||||||
|
|||||||
Reference in new issue
Block a user