Fixed side facing "AO"/lighting/shading, fix slight race condition in clearing data
This commit is contained in:
@@ -49,7 +49,8 @@ void main() {
|
||||
uint modelId = extractStateId(quad);
|
||||
BlockModel model = modelData[modelId];
|
||||
uint faceData = model.faceData[face];
|
||||
|
||||
bool hasAO = modelHasMipmaps(model);//TODO: replace with per face AO flag
|
||||
bool isShaded = hasAO;//TODO: make this a per face flag
|
||||
//Change the ordering due to backface culling
|
||||
//NOTE: when rendering, backface culling is disabled as we simply dispatch calls for each face
|
||||
// this has the advantage of having "unassigned" geometry, that is geometry where the backface isnt culled
|
||||
@@ -120,16 +121,21 @@ void main() {
|
||||
uint encodedData = 0;
|
||||
encodedData |= face;
|
||||
encodedData |= (lodLevel<<3);
|
||||
encodedData |= uint(modelHasMipmaps(model))<<6;//TODO: add if the face has AO as a face property instead of just using if it has mipmaps
|
||||
encodedData |= uint(hasAO)<<6;
|
||||
addin.w = float(encodedData)/255.0;
|
||||
}
|
||||
|
||||
//Apply face tint
|
||||
if ((face>>1) == 0) {
|
||||
tinting.xyz *= 1.0;
|
||||
} else if ((face>>1) == 1) {
|
||||
tinting.xyz *= 0.8;
|
||||
} else {
|
||||
tinting.xyz *= 0.6;
|
||||
if (isShaded) {
|
||||
if ((face>>1) == 1) {
|
||||
tinting.xyz *= 0.8f;
|
||||
} else if ((face>>1) == 2) {
|
||||
tinting.xyz *= 0.6f;
|
||||
} else if (face == 0){
|
||||
tinting.xyz *= 0.5f;
|
||||
} else {
|
||||
//TODO: FIXME: DONT HAVE SOME ARBITARY TINT LIKE THIS
|
||||
tinting.xyz *= 0.95f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,9 @@ layout(local_size_x = 32, local_size_y = 32) in;
|
||||
|
||||
layout(binding = 0, rgba8) uniform restrict image2D colourTex;
|
||||
layout(binding = 1) uniform sampler2D depthTex;
|
||||
layout(location = 2) uniform mat4 MVP;
|
||||
layout(location = 3) uniform mat4 invMVP;
|
||||
layout(binding = 2) uniform sampler2D colourTexCpy;
|
||||
layout(location = 3) uniform mat4 MVP;
|
||||
layout(location = 4) uniform mat4 invMVP;
|
||||
|
||||
vec3 rev3d(vec3 clip) {
|
||||
vec4 view = invMVP * vec4(clip*2.0-1.0,1.0);
|
||||
@@ -22,6 +23,10 @@ vec4 reDeProject(vec3 pos) {
|
||||
if (depth == 1.0f) {
|
||||
return vec4(-1.0f);
|
||||
}
|
||||
uint meta = uint(255.0f*texture(colourTexCpy, UV).w);
|
||||
if ((meta>>6)==0) {
|
||||
return vec4(-1.0f);
|
||||
}
|
||||
view.z = depth*2.0-1.0;
|
||||
view.w = 1.0;
|
||||
view = invMVP * view;
|
||||
|
||||
Reference in New Issue
Block a user