|
|
|
|
|
|
|
|
|
|
bool hitSuccessful = true; |
|
|
|
|
|
|
|
#ifdef DEBUG_DISPLAY |
|
|
|
int maxUsedLevel = currentLevel; |
|
|
|
#endif |
|
|
|
|
|
|
|
while (currentLevel >= minLevel) |
|
|
|
{ |
|
|
|
if (++iteration < MAX_ITERATIONS) |
|
|
|
|
|
|
if (hiZLinearDepth > testHitPositionTXS.z) |
|
|
|
{ |
|
|
|
currentLevel = min(maxLevel, currentLevel + 1); |
|
|
|
#ifdef DEBUG_DISPLAY |
|
|
|
maxUsedLevel = max(maxUsedLevel, currentLevel); |
|
|
|
#endif |
|
|
|
positionTXS = testHitPositionTXS; |
|
|
|
hit.distance += rayOffsetTestLength; |
|
|
|
} |
|
|
|
|
|
|
positionTXS += dirNDC * rayOffsetLength; |
|
|
|
hit.distance += rayOffsetLength; |
|
|
|
--currentLevel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
switch (_DebugLightingSubMode) |
|
|
|
{ |
|
|
|
case DEBUGSCREENSPACETRACING_POSITION_VS: |
|
|
|
case DEBUGSCREENSPACETRACING_POSITION_NDC: |
|
|
|
case DEBUGSCREENSPACETRACING_DIR_NDC: |
|
|
|
hit.debugOutput = dirNDC; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case DEBUGSCREENSPACETRACING_HIT_SUCCESS: |
|
|
|
hit.debugOutput = hitSuccessful; |
|
|
|
break; |
|
|
|
case DEBUGSCREENSPACETRACING_ITERATION_COUNT: |
|
|
|
hit.debugOutput = float(iteration) / float(MAX_ITERATIONS); |
|
|
|
break; |
|
|
|
case DEBUGSCREENSPACETRACING_MAX_USED_LEVEL: |
|
|
|
hit.debugOutput = float(maxUsedLevel) / float(maxLevel); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|