model metadata
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
layout(local_size_x = WIDTH, local_size_y = HEIGHT) in;
|
||||
|
||||
layout(binding = META_IN_BINDING) uniform usampler2D metaTexIn;
|
||||
layout(binding = COLOUR_IN_BINDING) uniform sampler2D colourTexIn;
|
||||
layout(binding = DEPTH_IN_BINDING) uniform sampler2D depthTexIn;
|
||||
layout(binding = STENCIL_IN_BINDING) uniform usampler2D stencilTexIn;
|
||||
@@ -24,8 +25,11 @@ void main() {
|
||||
|
||||
float depth = clamp(texelFetch(depthTexIn, samplePoint, 0).r, 0, 1);//Opengl grumble grumble
|
||||
uint stencil = texelFetch(stencilTexIn, samplePoint, 0).r;
|
||||
uint metadata = texelFetch(metaTexIn, samplePoint, 0).r;
|
||||
uint value = uint(depth*((1<<24)-1))<<8;
|
||||
value |= stencil;
|
||||
value |= stencil&0xFFu;
|
||||
//Use the very top bit of the stencil to mask if its tinted
|
||||
value |= (metadata&1u)<<7;
|
||||
outPoint.y = value;
|
||||
|
||||
outBuffer[globalOutIndex] = outPoint;
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
layout(location=0) uniform sampler2D tex;
|
||||
in vec2 texCoord;
|
||||
in flat uint metadata;
|
||||
out vec4 colour;
|
||||
layout(location=0) out vec4 colour;
|
||||
layout(location=1) out uvec4 metaOut;
|
||||
|
||||
void main() {
|
||||
colour = texture(tex, texCoord, ((~metadata>>1)&1u)*-16.0f);
|
||||
if (colour.a < 0.001f && ((metadata&1u)!=0)) {
|
||||
discard;
|
||||
}
|
||||
metaOut = uvec4((metadata>>2)&1u);//Write if it is or isnt tinted
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user