#version 460 core #extension GL_ARB_gpu_shader_int64 : enable #import #import layout(location = 0) out flat vec4 colour; uint extractLodLevel() { return uint(gl_BaseInstance)>>29; } //Note the last 2 bits of gl_BaseInstance are unused //Gives a relative position of +-255 relative to the player center in its respective lod ivec3 extractRelativeLodPos() { return (ivec3(gl_BaseInstance)<>ivec3(23); } vec4 uint2vec4RGBA(uint colour) { return vec4((uvec4(colour)>>uvec4(24,16,8,0))&uvec4(0xFF))/255; } void main() { int cornerIdx = gl_VertexID&3; Quad quad = quadData[uint(gl_VertexID)>>2]; vec3 innerPos = extractPos(quad); uint face = extractFace(quad); uint lodLevel = extractLodLevel(); ivec3 lodCorner = ((extractRelativeLodPos()<>1) == 0) { cornerIdx ^= 1; } ivec2 size = extractSize(quad) * ivec2((cornerIdx>>1)&1, cornerIdx&1) * (1<>1; if (axis == 0) { pos.xz += size; pos.y += (face&1)<>face)&1) == 1) { vec4 biomeColour = uint2vec4RGBA(biomeData[biomeId].foliage); colour *= biomeColour; } //Apply water tint if (((stateInfo.biomeTintMsk>>6)&1) == 1) { colour *= vec4(0.247, 0.463, 0.894, 1); } //Apply face tint if (face == 0) { colour.xyz *= vec3(0.75, 0.75, 0.75); } else if (face != 1) { colour.xyz *= vec3((float(face-2)/4)*0.25 + 0.75); } } //gl_Position = MVP * vec4(vec3(((cornerIdx)&1)+10,10,((cornerIdx>>1)&1)+10),1); //uint i = uint(quad>>32); //uint i = uint(gl_BaseInstance); //i ^= i>>16; //i *= 124128573; //i ^= i>>16; //i *= 4211346123; //i ^= i>>16; //i *= 462312435; //i ^= i>>16; //i *= 542354341; //i ^= i>>16; //uint i = uint(lodLevel+12)*215387625; //colour *= vec4(vec3(float((uint(i)>>2)&7)/7,float((uint(i)>>5)&7)/7,float((uint(i)>>8)&7)/7)*0.7+0.3,1); //colour = vec4(vec3(float((uint(i)>>2)&7)/7,float((uint(i)>>5)&7)/7,float((uint(i)>>8)&7)/7),1);