Tidying up unclassed ambient occlusion calculator.

This commit is contained in:
David Williams
2012-10-05 15:57:41 +02:00
parent 3b61adefaa
commit b86a3552e6
2 changed files with 25 additions and 22 deletions

View File

@ -30,7 +30,14 @@ freely, subject to the following restrictions:
using namespace PolyVox;
class IsVoxelTransparent
{
public:
bool operator()(uint8_t voxel)
{
return voxel == 0;
}
};
void TestAmbientOcclusionGenerator::testExecute()
{
@ -59,7 +66,8 @@ void TestAmbientOcclusionGenerator::testExecute()
Array<3, uint8_t> ambientOcclusionResult(ArraySizes(g_uArraySideLength)(g_uArraySideLength)(g_uArraySideLength));
// Calculate the ambient occlusion values
calculateAmbientOcclusion(&volData, &ambientOcclusionResult, volData.getEnclosingRegion(), 32.0f, 255/*, isVoxelTransparent*/);
IsVoxelTransparent isVoxelTransparent;
calculateAmbientOcclusion(&volData, &ambientOcclusionResult, volData.getEnclosingRegion(), 32.0f, 255, isVoxelTransparent);
//Check the results by sampling along a line though the centre of the volume. Because
//of the two walls we added, samples in the middle are darker than those at the edge.