Began work on a "permanent/proper" fix for determining what pixels are tinted and what arnt and by how much

This commit is contained in:
mcrcortex
2024-02-09 23:52:41 +10:00
parent c1460b649c
commit 5bf0a54686
3 changed files with 18 additions and 2 deletions

View File

@@ -190,7 +190,7 @@ public class ModelTextureBakery {
private ColourDepthTextureData captureView(BlockState state, BakedModel model, MatrixStack stack, long randomValue, int face, boolean renderFluid) { private ColourDepthTextureData captureView(BlockState state, BakedModel model, MatrixStack stack, long randomValue, int face, boolean renderFluid) {
var vc = Tessellator.getInstance().getBuffer(); var vc = Tessellator.getInstance().getBuffer();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
vc.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE); vc.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE);
if (!renderFluid) { if (!renderFluid) {
renderQuads(vc, state, model, new MatrixStack(), randomValue); renderQuads(vc, state, model, new MatrixStack(), randomValue);
@@ -281,7 +281,9 @@ public class ModelTextureBakery {
for (Direction direction : new Direction[]{Direction.DOWN, Direction.UP, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST, null}) { for (Direction direction : new Direction[]{Direction.DOWN, Direction.UP, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST, null}) {
var quads = model.getQuads(state, direction, new LocalRandom(randomValue)); var quads = model.getQuads(state, direction, new LocalRandom(randomValue));
for (var quad : quads) { for (var quad : quads) {
builder.quad(stack.peek(), quad, 0, 0, 0, 0, 0); //TODO: mark pixels that have
int meta = quad.hasColor()?1:0;
builder.quad(stack.peek(), quad, (meta>>16)&0xff, (meta>>8)&0xff, meta&0xff, 0, 0);
} }
} }
} }

View File

@@ -22,6 +22,16 @@ public class SaveSelectionSystem {
} }
public WorldEngine createWorldEngine() { public WorldEngine createWorldEngine() {
//TODO: have basicly a recursive config tree for StorageBackend
// with a .build() method
// also have a way for the config to specify and create a config "screen"
// e.g. CompressionStorageAdaptorConfig(StorageCompressorConfig, StorageBackendConfig)
// FragmentedStorageBackendAdaptorConfig(File)
// RocksDBStorageBackendConfig(File)
// RedisStorageBackendConfig(String, int, String)
var storage = new CompressionStorageAdaptor(new ZSTDCompressor(VoxyConfig.CONFIG.savingCompressionLevel), new FragmentedStorageBackendAdaptor(new File(VoxyConfig.CONFIG.storagePath))); var storage = new CompressionStorageAdaptor(new ZSTDCompressor(VoxyConfig.CONFIG.savingCompressionLevel), new FragmentedStorageBackendAdaptor(new File(VoxyConfig.CONFIG.storagePath)));
return new WorldEngine(storage, VoxyConfig.CONFIG.ingestThreads, VoxyConfig.CONFIG.savingThreads, 5); return new WorldEngine(storage, VoxyConfig.CONFIG.ingestThreads, VoxyConfig.CONFIG.savingThreads, 5);
} }

View File

@@ -1,12 +1,16 @@
#version 430 #version 430
in vec3 pos; in vec3 pos;
in vec4 _metadata;
in vec2 uv; in vec2 uv;
layout(location=1) uniform mat4 transform; layout(location=1) uniform mat4 transform;
out vec2 texCoord; out vec2 texCoord;
void main() { void main() {
uvec4 metadata = uvec4(_metadata*255);
uint metadata = (metadata.r<<16)|(metadata.g<<8)|(metadata.b);
gl_Position = transform * vec4(pos, 1.0); gl_Position = transform * vec4(pos, 1.0);
texCoord = uv; texCoord = uv;
} }