Fix issues
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
#line 1
|
|
||||||
|
|
||||||
layout(binding = 0, std140) uniform SceneUniform {
|
layout(binding = 0, std140) uniform SceneUniform {
|
||||||
mat4 MVP;
|
mat4 MVP;
|
||||||
ivec3 baseSectionPos;
|
ivec3 baseSectionPos;
|
||||||
|
|||||||
@@ -23,18 +23,27 @@ vec4 uint2vec4RGBA(uint colour) {
|
|||||||
return vec4((uvec4(colour)>>uvec4(24,16,8,0))&uvec4(0xFF))/255.0;
|
return vec4((uvec4(colour)>>uvec4(24,16,8,0))&uvec4(0xFF))/255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 computeColour(vec4 colour) {
|
bool useMipmaps() {
|
||||||
//Conditional tinting, TODO: FIXME: REPLACE WITH MASK OR SOMETHING, like encode data into the top bit of alpha
|
return (interData.x&2u)==0u;
|
||||||
if ((interData.x&(1u<<2)) != 0 && abs(colour.r-colour.g) < 0.02f && abs(colour.g-colour.b) < 0.02f) {
|
|
||||||
colour *= uint2vec4RGBA(interData.z).yzwx;
|
|
||||||
}
|
|
||||||
return (colour * uint2vec4RGBA(interData.y)) + (float(interData.w&0xFFu)/255);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useMipmaps() {
|
bool useTinting() {
|
||||||
return ((interData.x>>1)&1u)==0u;
|
return (interData.x&4u)!=0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useCutout() {
|
||||||
|
return (interData.x&1u)==1u;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 computeColour(vec4 colour) {
|
||||||
|
//Conditional tinting, TODO: FIXME: REPLACE WITH MASK OR SOMETHING, like encode data into the top bit of alpha
|
||||||
|
if (useTinting() && abs(colour.r-colour.g) < 0.02f && abs(colour.g-colour.b) < 0.02f) {
|
||||||
|
colour *= uint2vec4RGBA(interData.z).yzwx;
|
||||||
|
}
|
||||||
|
return (colour * uint2vec4RGBA(interData.y)) + vec4(0,0,0,float(interData.w&0xFFu)/255);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint getFace() {
|
uint getFace() {
|
||||||
return (interData.w>>8)&7u;
|
return (interData.w>>8)&7u;
|
||||||
}
|
}
|
||||||
@@ -72,7 +81,7 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
//Also, small quad is really fking over the mipping level somehow
|
//Also, small quad is really fking over the mipping level somehow
|
||||||
if ((interData.x&1u) == 1 && (texture(blockModelAtlas, texPos, -16.0).a <= 0.1f)) {
|
if (useCutout() && (texture(blockModelAtlas, texPos, -16.0).a <= 0.1f)) {
|
||||||
//This is stupidly stupidly bad for divergence
|
//This is stupidly stupidly bad for divergence
|
||||||
//TODO: FIXME, basicly what this do is sample the exact pixel (no lod) for discarding, this stops mipmapping fucking it over
|
//TODO: FIXME, basicly what this do is sample the exact pixel (no lod) for discarding, this stops mipmapping fucking it over
|
||||||
#ifndef DEBUG_RENDER
|
#ifndef DEBUG_RENDER
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ void setSizeAndFlags(uint modelId, uint _flags, ivec2 quadSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setTintingAndExtra(vec4 _tinting, uint _conditionalTinting, uint alphaAddin, uint face) {
|
void setTintingAndExtra(vec4 _tinting, uint _conditionalTinting, uint alphaAddin, uint face) {
|
||||||
uint packed = alphaAddin|(face<<8);
|
uint packedData = alphaAddin|(face<<8);
|
||||||
interData.y = packVec4(_tinting);
|
interData.y = packVec4(_tinting);
|
||||||
interData.z = _conditionalTinting;
|
interData.z = _conditionalTinting;
|
||||||
interData.w = packed;
|
interData.w = packedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_RENDER
|
#ifdef DEBUG_RENDER
|
||||||
@@ -163,7 +163,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSizeAndFlags(modelId, flags, quadSize);
|
setSizeAndFlags(modelId, flags, quadSize);
|
||||||
setTinting(tinting, conditionalTinting, alphaAddin, face);
|
setTintingAndExtra(tinting, conditionalTinting, alphaAddin, face);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 faceSize = getFaceSize(faceData);
|
vec4 faceSize = getFaceSize(faceData);
|
||||||
|
|||||||
Reference in New Issue
Block a user