diff --git a/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h b/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h index 4c4ea164..cafcf6bc 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h +++ b/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h @@ -31,9 +31,11 @@ freely, subject to the following restrictions: #include "PolyVoxCore/Region.h" #include "PolyVoxCore/Raycast.h" -//These two should not be here! -#include "PolyVoxCore/Material.h" -#include "PolyVoxCore/SimpleVolume.h" +#if defined(_MSC_VER) + //These two should not be here! + #include "PolyVoxCore/Material.h" + #include "PolyVoxCore/SimpleVolume.h" +#endif #include diff --git a/tests/TestAmbientOcclusionGenerator.cpp b/tests/TestAmbientOcclusionGenerator.cpp index 4e192030..34f9df00 100644 --- a/tests/TestAmbientOcclusionGenerator.cpp +++ b/tests/TestAmbientOcclusionGenerator.cpp @@ -24,16 +24,15 @@ freely, subject to the following restrictions: #include "TestAmbientOcclusionGenerator.h" #include "PolyVoxCore/AmbientOcclusionCalculator.h" -#include "PolyVoxCore/Material.h" #include "PolyVoxCore/SimpleVolume.h" #include using namespace PolyVox; -bool isVoxelTransparent(Material8 voxel) +bool isVoxelTransparent(uint8_t voxel) { - return voxel.getMaterial() == 0; + return voxel == 0; } void TestAmbientOcclusionGenerator::testExecute() @@ -41,7 +40,7 @@ void TestAmbientOcclusionGenerator::testExecute() const int32_t g_uVolumeSideLength = 64; //Create empty volume - SimpleVolume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1))); + SimpleVolume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1))); //Create two solid walls at opposite sides of the volume for (int32_t z = 0; z < g_uVolumeSideLength; z++) @@ -52,8 +51,7 @@ void TestAmbientOcclusionGenerator::testExecute() { for (int32_t x = 0; x < g_uVolumeSideLength; x++) { - Material8 voxel(1); - volData.setVoxelAt(x, y, z, voxel); + volData.setVoxelAt(x, y, z, 1); } } } @@ -64,7 +62,7 @@ void TestAmbientOcclusionGenerator::testExecute() Array<3, uint8_t> ambientOcclusionResult(ArraySizes(g_uArraySideLength)(g_uArraySideLength)(g_uArraySideLength)); //Create the ambient occlusion calculator - AmbientOcclusionCalculator calculator(&volData, &ambientOcclusionResult, volData.getEnclosingRegion(), 32.0f, 255, isVoxelTransparent); + AmbientOcclusionCalculator calculator(&volData, &ambientOcclusionResult, volData.getEnclosingRegion(), 32.0f, 255, isVoxelTransparent); //Execute the calculator calculator.execute(); diff --git a/tests/TestRaycast.cpp b/tests/TestRaycast.cpp index 39d53705..72c5586e 100644 --- a/tests/TestRaycast.cpp +++ b/tests/TestRaycast.cpp @@ -33,9 +33,9 @@ freely, subject to the following restrictions: using namespace PolyVox; -bool isPassableByRay(const SimpleVolume::Sampler& sampler) +bool isPassableByRay(const SimpleVolume::Sampler& sampler) { - return sampler.getVoxel().getDensity() < Density8::getThreshold(); + return sampler.getVoxel() <= 0; } void TestRaycast::testExecute() @@ -43,25 +43,21 @@ void TestRaycast::testExecute() const int32_t uVolumeSideLength = 32; //Create a hollow volume, with solid sides on x and y but with open ends in z. - SimpleVolume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1))); + SimpleVolume volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1))); for (int32_t z = 0; z < uVolumeSideLength; z++) { for (int32_t y = 0; y < uVolumeSideLength; y++) { for (int32_t x = 0; x < uVolumeSideLength; x++) { - Density8 voxelValue; - if((x == 0) || (x == uVolumeSideLength-1) || (y == 0) || (y == uVolumeSideLength-1)) { - voxelValue.setDensity(255); + volData.setVoxelAt(x, y, z, 100); } else { - voxelValue.setDensity(0); - } - - volData.setVoxelAt(x, y, z, voxelValue); + volData.setVoxelAt(x, y, z, -100); + } } } } @@ -72,7 +68,7 @@ void TestRaycast::testExecute() for(int ct = 0; ct < 1000000; ct++) { RaycastResult result; - Raycast raycast(&volData, start, randomUnitVectors[ct % 1024] * 1000.0f, result, isPassableByRay); + Raycast raycast(&volData, start, randomUnitVectors[ct % 1024] * 1000.0f, result, isPassableByRay); raycast.execute(); if(result.foundIntersection) {