Fixing coding guidelines

This commit is contained in:
samcake 2016-01-21 16:54:37 -08:00
parent 402809fe2f
commit 8eddd52731
3 changed files with 11 additions and 7 deletions

View file

@ -134,10 +134,10 @@ float getBlurEdgeSharpness() {
return params._blurInfo.x;
}
// KEEP this dead code for eventual performance improvment
#ifdef CONSTANT_GAUSSIAN
const int BLUR_RADIUS = 4;
const float gaussian[BLUR_RADIUS + 1] =
// KEEP this dead code for eventual performance improvment
// float[](0.356642, 0.239400, 0.072410, 0.009869);
// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
@ -183,6 +183,8 @@ vec2 fetchOcclusionDepth(ivec2 coords) {
}
const int RADIUS_SCALE = 2;
const float BLUR_WEIGHT_OFFSET = 0.3;
const float BLUR_EDGE_SCALE = 2000.0;
vec2 evalTapWeightedValue(ivec3 side, int r, ivec2 ssC, float key) {
ivec2 tapOffset = <$axis$> * (r * RADIUS_SCALE);
@ -194,10 +196,10 @@ vec2 evalTapWeightedValue(ivec3 side, int r, ivec2 ssC, float key) {
vec2 tapOZ = fetchOcclusionDepth(ssC + tapOffset);
// spatial domain: offset gaussian tap
float weight = 0.3 + getBlurCoef(abs(r));
float weight = BLUR_WEIGHT_OFFSET + getBlurCoef(abs(r));
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
weight *= max(0.0, 1.0 - (getBlurEdgeSharpness() * 2000.0) * abs(tapOZ.y - key));
weight *= max(0.0, 1.0 - (getBlurEdgeSharpness() * BLUR_EDGE_SCALE) * abs(tapOZ.y - key));
return vec2(tapOZ.x * weight, weight);
}

View file

@ -41,10 +41,12 @@ float getAngleDithering(in ivec2 pixelPos) {
return isDitheringEnabled() * (3 * pixelPos.x ^ pixelPos.y + pixelPos.x * pixelPos.y) * 10 + getFrameDithering();
}
const float TWO_PI = 6.28;
vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){
// Radius relative to ssR
float alpha = float(sampleNumber + 0.5) * getInvNumSamples();
float angle = alpha * (getNumSpiralTurns() * 6.28) + spinAngle;
float angle = alpha * (getNumSpiralTurns() * TWO_PI) + spinAngle;
ssR = alpha;
return vec2(cos(angle), sin(angle));
@ -133,12 +135,12 @@ void main(void) {
// Bilateral box-filter over a quad for free, respecting depth edges
// (the difference that this makes is subtle)
/* if (abs(dFdx(Cp.z)) < 0.02) {
if (abs(dFdx(Cp.z)) < 0.02) {
A -= dFdx(A) * ((ssC.x & 1) - 0.5);
}
if (abs(dFdy(Cp.z)) < 0.02) {
A -= dFdy(A) * ((ssC.y & 1) - 0.5);
}*/
}
outFragColor = vec4(packOcclusionDepth(A, CSZToDephtKey(Cp.z)), 1.0);

View file

@ -113,7 +113,7 @@ protected:
int _drawStatus; // bitflag
bool _drawHitEffect;
bool _occlusionStatus { false };
bool _fxaaStatus = { false };
bool _fxaaStatus { false };
ItemsConfig _items;
Tone _tone;