Applied default Visual Studio formatting to most files. This is a quick fix for the tabs vs spaces issue that messes up the formatting in any editor (esp. Linux) which handles tabs/spaces differently to Visual Studio. Some parts of the formatting look a bit worse but overall it should be better (or at least more consistent).
I didn't apply the changes to a few macro-heavy files as Visual Studio removes all indentation from macros, whereas the indentation can be handy to see nesting.
This commit is contained in:
@@ -36,13 +36,13 @@ template< typename VolumeType>
|
||||
bool testVoxelValidator(const VolumeType* volData, const Vector3DInt32& v3dPos)
|
||||
{
|
||||
//Voxels are considered valid candidates for the path if they are inside the volume...
|
||||
if(volData->getEnclosingRegion().containsPoint(v3dPos) == false)
|
||||
if (volData->getEnclosingRegion().containsPoint(v3dPos) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
typename VolumeType::VoxelType voxel = volData->getVoxel(v3dPos);
|
||||
if(voxel != 0)
|
||||
if (voxel != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -52,61 +52,61 @@ bool testVoxelValidator(const VolumeType* volData, const Vector3DInt32& v3dPos)
|
||||
|
||||
void TestAStarPathfinder::testExecute()
|
||||
{
|
||||
const Vector3DInt32 expectedResult[] =
|
||||
const Vector3DInt32 expectedResult[] =
|
||||
{
|
||||
Vector3DInt32(0,0,0),
|
||||
Vector3DInt32(1,1,1),
|
||||
Vector3DInt32(2,1,2),
|
||||
Vector3DInt32(3,1,3),
|
||||
Vector3DInt32(3,1,4),
|
||||
Vector3DInt32(3,1,5),
|
||||
Vector3DInt32(3,1,6),
|
||||
Vector3DInt32(3,1,7),
|
||||
Vector3DInt32(4,2,8),
|
||||
Vector3DInt32(5,3,9),
|
||||
Vector3DInt32(5,3,10),
|
||||
Vector3DInt32(5,3,11),
|
||||
Vector3DInt32(6,4,12),
|
||||
Vector3DInt32(7,5,13),
|
||||
Vector3DInt32(8,6,13),
|
||||
Vector3DInt32(9,7,13),
|
||||
Vector3DInt32(9,8,13),
|
||||
Vector3DInt32(10,9,13),
|
||||
Vector3DInt32(11,10,14),
|
||||
Vector3DInt32(12,11,15),
|
||||
Vector3DInt32(13,12,15),
|
||||
Vector3DInt32(14,13,15),
|
||||
Vector3DInt32(14,14,15),
|
||||
Vector3DInt32(15,15,15)
|
||||
Vector3DInt32(0, 0, 0),
|
||||
Vector3DInt32(1, 1, 1),
|
||||
Vector3DInt32(2, 1, 2),
|
||||
Vector3DInt32(3, 1, 3),
|
||||
Vector3DInt32(3, 1, 4),
|
||||
Vector3DInt32(3, 1, 5),
|
||||
Vector3DInt32(3, 1, 6),
|
||||
Vector3DInt32(3, 1, 7),
|
||||
Vector3DInt32(4, 2, 8),
|
||||
Vector3DInt32(5, 3, 9),
|
||||
Vector3DInt32(5, 3, 10),
|
||||
Vector3DInt32(5, 3, 11),
|
||||
Vector3DInt32(6, 4, 12),
|
||||
Vector3DInt32(7, 5, 13),
|
||||
Vector3DInt32(8, 6, 13),
|
||||
Vector3DInt32(9, 7, 13),
|
||||
Vector3DInt32(9, 8, 13),
|
||||
Vector3DInt32(10, 9, 13),
|
||||
Vector3DInt32(11, 10, 14),
|
||||
Vector3DInt32(12, 11, 15),
|
||||
Vector3DInt32(13, 12, 15),
|
||||
Vector3DInt32(14, 13, 15),
|
||||
Vector3DInt32(14, 14, 15),
|
||||
Vector3DInt32(15, 15, 15)
|
||||
};
|
||||
|
||||
const int32_t uVolumeSideLength = 16;
|
||||
|
||||
//Create a volume
|
||||
RawVolume<uint8_t> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1)));
|
||||
RawVolume<uint8_t> volData(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(uVolumeSideLength - 1, uVolumeSideLength - 1, uVolumeSideLength - 1)));
|
||||
|
||||
//Clear the volume
|
||||
for(int z = 0; z < uVolumeSideLength; z++)
|
||||
for (int z = 0; z < uVolumeSideLength; z++)
|
||||
{
|
||||
for(int y = 0; y < uVolumeSideLength; y++)
|
||||
for (int y = 0; y < uVolumeSideLength; y++)
|
||||
{
|
||||
for(int x = 0; x < uVolumeSideLength; x++)
|
||||
for (int x = 0; x < uVolumeSideLength; x++)
|
||||
{
|
||||
uint8_t solidVoxel(0);
|
||||
volData.setVoxel(x,y,z,solidVoxel);
|
||||
volData.setVoxel(x, y, z, solidVoxel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Place a solid cube in the middle of it
|
||||
for(int z = 4; z < 12; z++)
|
||||
for (int z = 4; z < 12; z++)
|
||||
{
|
||||
for(int y = 4; y < 12; y++)
|
||||
for (int y = 4; y < 12; y++)
|
||||
{
|
||||
for(int x = 4; x < 12; x++)
|
||||
for (int x = 4; x < 12; x++)
|
||||
{
|
||||
uint8_t solidVoxel(1);
|
||||
volData.setVoxel(x,y,z,solidVoxel);
|
||||
volData.setVoxel(x, y, z, solidVoxel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,20 +115,20 @@ void TestAStarPathfinder::testExecute()
|
||||
std::list<Vector3DInt32> result;
|
||||
|
||||
//Create an AStarPathfinder
|
||||
AStarPathfinderParams< RawVolume<uint8_t> > params(&volData, Vector3DInt32(0,0,0), Vector3DInt32(15,15,15), &result, 1.0f, 10000, TwentySixConnected, &testVoxelValidator<RawVolume<uint8_t> >);
|
||||
AStarPathfinderParams< RawVolume<uint8_t> > params(&volData, Vector3DInt32(0, 0, 0), Vector3DInt32(15, 15, 15), &result, 1.0f, 10000, TwentySixConnected, &testVoxelValidator<RawVolume<uint8_t> >);
|
||||
AStarPathfinder< RawVolume<uint8_t> > pathfinder(params);
|
||||
|
||||
//Execute the pathfinder.
|
||||
QBENCHMARK {
|
||||
QBENCHMARK{
|
||||
pathfinder.execute();
|
||||
}
|
||||
|
||||
//Make sure the right number of steps were created.
|
||||
//Make sure the right number of steps were created.
|
||||
QCOMPARE(result.size(), static_cast<size_t>(24));
|
||||
|
||||
//Make sure that each step is correct.
|
||||
uint32_t uExpectedIndex = 0;
|
||||
for(std::list<Vector3DInt32>::iterator iterResult = result.begin(); iterResult != result.end(); iterResult++)
|
||||
for (std::list<Vector3DInt32>::iterator iterResult = result.begin(); iterResult != result.end(); iterResult++)
|
||||
{
|
||||
Vector3DInt32 res = *iterResult;
|
||||
Vector3DInt32 exp = expectedResult[uExpectedIndex];
|
||||
|
@@ -62,7 +62,7 @@ void TestAmbientOcclusionGenerator::testExecute()
|
||||
//Create two solid walls at opposite sides of the volume
|
||||
for (int32_t z = 0; z < g_uVolumeSideLength; z++)
|
||||
{
|
||||
if((z < 20) || (z > g_uVolumeSideLength - 20))
|
||||
if ((z < 20) || (z > g_uVolumeSideLength - 20))
|
||||
{
|
||||
for (int32_t y = 0; y < g_uVolumeSideLength; y++)
|
||||
{
|
||||
@@ -80,21 +80,21 @@ void TestAmbientOcclusionGenerator::testExecute()
|
||||
|
||||
// Calculate the ambient occlusion values
|
||||
IsVoxelTransparent isVoxelTransparent;
|
||||
QBENCHMARK {
|
||||
QBENCHMARK{
|
||||
calculateAmbientOcclusion(&volData, &ambientOcclusionResult, region, 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.
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 0, 16)), 178);
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 8, 16)), 109);
|
||||
|
||||
//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.
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 0, 16)), 178);
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 8, 16)), 109);
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 16, 16)), 103);
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 24, 16)), 123);
|
||||
QCOMPARE(static_cast<int>(ambientOcclusionResult(16, 31, 16)), 173);
|
||||
|
||||
|
||||
//Just run a quick test to make sure that it compiles when taking a function pointer
|
||||
calculateAmbientOcclusion(&volData, &ambientOcclusionResult, region, 32.0f, 8, &isVoxelTransparentFunction);
|
||||
|
||||
|
||||
//Also test it using a lambda
|
||||
//calculateAmbientOcclusion(&volData, &ambientOcclusionResult, volData.getEnclosingRegion(), 32.0f, 8, [](uint8_t voxel){return voxel == 0;});
|
||||
}
|
||||
|
@@ -94,11 +94,11 @@ void TestArray::testReadWrite()
|
||||
|
||||
int ct = 1;
|
||||
int expectedTotal = 0;
|
||||
for(int z = 0; z < depth; z++)
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
for(int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for(int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
myArray(x, y, z) = ct;
|
||||
expectedTotal += myArray(x, y, z);
|
||||
@@ -109,11 +109,11 @@ void TestArray::testReadWrite()
|
||||
|
||||
ct = 1;
|
||||
int total = 0;
|
||||
for(int z = 0; z < depth; z++)
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
for(int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for(int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
QCOMPARE(myArray(x, y, z), ct);
|
||||
total += myArray(x, y, z);
|
||||
|
@@ -36,7 +36,7 @@ void TestLowPassFilter::testExecute()
|
||||
{
|
||||
const int32_t g_uVolumeSideLength = 8;
|
||||
|
||||
Region reg(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1));
|
||||
Region reg(Vector3DInt32(0, 0, 0), Vector3DInt32(g_uVolumeSideLength - 1, g_uVolumeSideLength - 1, g_uVolumeSideLength - 1));
|
||||
|
||||
//Create empty volume
|
||||
RawVolume<Density8> volData(reg);
|
||||
@@ -48,7 +48,7 @@ void TestLowPassFilter::testExecute()
|
||||
{
|
||||
for (int32_t x = 0; x < g_uVolumeSideLength; x++)
|
||||
{
|
||||
if(x % 2 == 0)
|
||||
if (x % 2 == 0)
|
||||
{
|
||||
Density8 voxel(32);
|
||||
volData.setVoxel(x, y, z, voxel);
|
||||
@@ -62,30 +62,30 @@ void TestLowPassFilter::testExecute()
|
||||
LowPassFilter< RawVolume<Density8>, RawVolume<Density8>, Density16 > lowPassfilter(&volData, reg, &resultVolume, reg, 3);
|
||||
|
||||
//Test the normal implementation
|
||||
QBENCHMARK {
|
||||
QBENCHMARK{
|
||||
lowPassfilter.execute();
|
||||
}
|
||||
QCOMPARE(resultVolume.getVoxel(0,0,0), Density8(4));
|
||||
QCOMPARE(resultVolume.getVoxel(1,1,1), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(2,2,2), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(3,3,3), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(4,4,4), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(5,5,5), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(6,6,6), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(7,7,7), Density8(4));
|
||||
QCOMPARE(resultVolume.getVoxel(0, 0, 0), Density8(4));
|
||||
QCOMPARE(resultVolume.getVoxel(1, 1, 1), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(2, 2, 2), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(3, 3, 3), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(4, 4, 4), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(5, 5, 5), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(6, 6, 6), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(7, 7, 7), Density8(4));
|
||||
|
||||
//Test the SAT implmentation
|
||||
QBENCHMARK {
|
||||
QBENCHMARK{
|
||||
lowPassfilter.executeSAT();
|
||||
}
|
||||
QCOMPARE(resultVolume.getVoxel(0,0,0), Density8(4));
|
||||
QCOMPARE(resultVolume.getVoxel(1,1,1), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(2,2,2), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(3,3,3), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(4,4,4), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(5,5,5), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(6,6,6), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(7,7,7), Density8(4));
|
||||
QCOMPARE(resultVolume.getVoxel(0, 0, 0), Density8(4));
|
||||
QCOMPARE(resultVolume.getVoxel(1, 1, 1), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(2, 2, 2), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(3, 3, 3), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(4, 4, 4), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(5, 5, 5), Density8(21));
|
||||
QCOMPARE(resultVolume.getVoxel(6, 6, 6), Density8(10));
|
||||
QCOMPARE(resultVolume.getVoxel(7, 7, 7), Density8(4));
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestLowPassFilter)
|
||||
|
@@ -42,7 +42,7 @@ void TestPicking::testExecute()
|
||||
{
|
||||
for (int32_t x = 0; x < uVolumeSideLength; x++)
|
||||
{
|
||||
if((x > uVolumeSideLength/2)) //x > 16 is filled
|
||||
if ((x > uVolumeSideLength / 2)) //x > 16 is filled
|
||||
{
|
||||
volData.setVoxel(x, y, z, 100);
|
||||
}
|
||||
@@ -56,13 +56,13 @@ void TestPicking::testExecute()
|
||||
|
||||
const int8_t emptyVoxelExample = 0; //A voxel value of zero will represent empty space.
|
||||
PickResult resultHit = pickVoxel(&volData, Vector3DFloat(0, uVolumeSideLength / 2, uVolumeSideLength / 2), Vector3DFloat(uVolumeSideLength, 0, 0), emptyVoxelExample);
|
||||
|
||||
|
||||
QCOMPARE(resultHit.didHit, true);
|
||||
QCOMPARE(resultHit.hitVoxel, Vector3DInt32((uVolumeSideLength / 2) + 1, uVolumeSideLength / 2, uVolumeSideLength / 2));
|
||||
QCOMPARE(resultHit.previousVoxel, Vector3DInt32((uVolumeSideLength / 2), uVolumeSideLength / 2, uVolumeSideLength / 2));
|
||||
|
||||
|
||||
PickResult resultMiss = pickVoxel(&volData, Vector3DFloat(0, uVolumeSideLength / 2, uVolumeSideLength / 2), Vector3DFloat(uVolumeSideLength / 2, uVolumeSideLength, uVolumeSideLength), emptyVoxelExample);
|
||||
|
||||
|
||||
QCOMPARE(resultMiss.didHit, false);
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ class RaycastTestFunctor
|
||||
public:
|
||||
RaycastTestFunctor()
|
||||
:m_uVoxelsTouched(0)
|
||||
,m_bRayLeftVolume(false)
|
||||
, m_bRayLeftVolume(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
// For this particular test we know that we are always starting a ray inside the volume,
|
||||
// so if it ever leaves the volume we know it can't go back in and so we can terminate early.
|
||||
// This optimisation is worthwhile because samplers get slow once outside the volume.
|
||||
if(!sampler.isCurrentPositionValid())
|
||||
if (!sampler.isCurrentPositionValid())
|
||||
{
|
||||
m_bRayLeftVolume = true;
|
||||
return false;
|
||||
@@ -81,20 +81,20 @@ void TestRaycast::testExecute()
|
||||
{
|
||||
for (int32_t x = 0; x < uVolumeSideLength; x++)
|
||||
{
|
||||
if((x == 0) || (x == uVolumeSideLength-1) || (y == 0) || (y == uVolumeSideLength-1))
|
||||
if ((x == 0) || (x == uVolumeSideLength - 1) || (y == 0) || (y == uVolumeSideLength - 1))
|
||||
{
|
||||
volData.setVoxel(x, y, z, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
volData.setVoxel(x, y, z, -100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Cast rays from the centre. Roughly 2/3 should escape.
|
||||
Vector3DFloat start (uVolumeSideLength / 2, uVolumeSideLength / 2, uVolumeSideLength / 2);
|
||||
Vector3DFloat start(uVolumeSideLength / 2, uVolumeSideLength / 2, uVolumeSideLength / 2);
|
||||
|
||||
// We could have counted the total number of hits in the same way as the total number of voxels
|
||||
// touched, but for demonstration and testing purposes we are making use of the raycast return value
|
||||
@@ -103,7 +103,7 @@ void TestRaycast::testExecute()
|
||||
uint32_t uTotalVoxelsTouched = 0;
|
||||
|
||||
// Cast a large number of random rays
|
||||
for(int ct = 0; ct < 1000000; ct++)
|
||||
for (int ct = 0; ct < 1000000; ct++)
|
||||
{
|
||||
RaycastTestFunctor raycastTestFunctor;
|
||||
RaycastResult result = raycastWithDirection(&volData, start, randomUnitVectors[ct % 1024] * 1000.0f, raycastTestFunctor);
|
||||
@@ -112,11 +112,11 @@ void TestRaycast::testExecute()
|
||||
|
||||
// If the raycast completed then we know it did not hit anything.If it was interupted then it
|
||||
// probably hit something, unless we noted that the reason it was interupted was that it left the volume.
|
||||
if((result == RaycastResults::Interupted) && (raycastTestFunctor.m_bRayLeftVolume == false))
|
||||
if ((result == RaycastResults::Interupted) && (raycastTestFunctor.m_bRayLeftVolume == false))
|
||||
{
|
||||
hits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check the number of hits.
|
||||
QCOMPARE(hits, 687494);
|
||||
|
@@ -32,9 +32,9 @@ using namespace PolyVox;
|
||||
|
||||
void TestRegion::testEquality()
|
||||
{
|
||||
Region reg1(1,2,3,4,5,6);
|
||||
Region reg2(0,0,0,10,20,30);
|
||||
Region reg3(Vector3DInt32(1,2,3), Vector3DInt32(4,5,6));
|
||||
Region reg1(1, 2, 3, 4, 5, 6);
|
||||
Region reg2(0, 0, 0, 10, 20, 30);
|
||||
Region reg3(Vector3DInt32(1, 2, 3), Vector3DInt32(4, 5, 6));
|
||||
|
||||
QCOMPARE(reg1 != reg2, true);
|
||||
QCOMPARE(reg1 == reg3, true);
|
||||
|
@@ -46,17 +46,17 @@ public:
|
||||
//in the future
|
||||
//typedef BaseVolume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences. See http://goo.gl/qu1wn
|
||||
//class Sampler : public VolumeOfVoxelType::template Sampler< VolumeSubclass<VoxelType> >
|
||||
#if defined(_MSC_VER)
|
||||
class Sampler : public BaseVolume<VoxelType>::Sampler< VolumeSubclass<VoxelType> > //This line works on VS2010
|
||||
#else
|
||||
class Sampler : public BaseVolume<VoxelType>::template Sampler< VolumeSubclass<VoxelType> > //This line works on GCC
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
class Sampler : public BaseVolume<VoxelType>::Sampler< VolumeSubclass<VoxelType> > //This line works on VS2010
|
||||
#else
|
||||
class Sampler : public BaseVolume<VoxelType>::template Sampler< VolumeSubclass<VoxelType> > //This line works on GCC
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
Sampler(VolumeSubclass<VoxelType>* volume)
|
||||
:BaseVolume<VoxelType>::template Sampler< VolumeSubclass<VoxelType> >(volume)
|
||||
{
|
||||
this->mVolume = volume;
|
||||
this->mVolume = volume;
|
||||
}
|
||||
//~Sampler();
|
||||
};
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
:BaseVolume<VoxelType>()
|
||||
, mVolumeData(regValid.getWidthInVoxels(), regValid.getHeightInVoxels(), regValid.getDepthInVoxels())
|
||||
{
|
||||
//mVolumeData.resize(ArraySizes(this->getWidth())(this->getHeight())(this->getDepth()));
|
||||
//mVolumeData.resize(ArraySizes(this->getWidth())(this->getHeight())(this->getDepth()));
|
||||
}
|
||||
/// Destructor
|
||||
~VolumeSubclass() {};
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates
|
||||
bool setVoxel(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
|
||||
{
|
||||
if( (uXPos >= 0) && (uXPos < static_cast<int32_t>(mVolumeData.getDimension(0))) &&
|
||||
if ((uXPos >= 0) && (uXPos < static_cast<int32_t>(mVolumeData.getDimension(0))) &&
|
||||
(uYPos >= 0) && (uYPos < static_cast<int32_t>(mVolumeData.getDimension(1))) &&
|
||||
(uZPos >= 0) && (uZPos < static_cast<int32_t>(mVolumeData.getDimension(2))))
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
/// Calculates approximatly how many bytes of memory the volume is currently using.
|
||||
uint32_t calculateSizeInBytes(void) { return 0; }
|
||||
|
||||
private:
|
||||
private:
|
||||
Array<3, VoxelType> mVolumeData;
|
||||
};
|
||||
|
||||
@@ -131,7 +131,7 @@ void TestVolumeSubclass::testExtractSurface()
|
||||
for (int32_t x = 0; x < region.getWidthInVoxels(); x++)
|
||||
{
|
||||
Material8 mat(1);
|
||||
volumeSubclass.setVoxel(Vector3DInt32(x,y,z),mat);
|
||||
volumeSubclass.setVoxel(Vector3DInt32(x, y, z), mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,14 +39,14 @@ Vector3DFloat incrementVector(Vector3DFloat input)
|
||||
void TestVector::testLength()
|
||||
{
|
||||
Vector3DInt8 vec(3, 4, 5);
|
||||
QCOMPARE(vec.lengthSquared(), int32_t(3*3+4*4+5*5)); // QCOMPARE is strict on types. For an int8 vector, the OperationType is int32_t.
|
||||
QCOMPARE(vec.lengthSquared(), int32_t(3 * 3 + 4 * 4 + 5 * 5)); // QCOMPARE is strict on types. For an int8 vector, the OperationType is int32_t.
|
||||
}
|
||||
|
||||
void TestVector::testDotProduct()
|
||||
{
|
||||
Vector3DInt8 vecxy(3, 4, 0);
|
||||
Vector3DInt8 vecz(0, 0, 1);
|
||||
|
||||
|
||||
QCOMPARE(vecxy.dot(vecz), int32_t(0)); // QCOMPARE is strict on types. For an int8 vector, the OperationType is int32_t .
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void TestVector::testEquality()
|
||||
{
|
||||
Vector3DInt8 vecxy(3, 4, 0);
|
||||
Vector3DInt8 vecz(0, 0, 1);
|
||||
|
||||
|
||||
QCOMPARE(vecxy != vecz, true);
|
||||
}
|
||||
|
||||
@@ -64,13 +64,13 @@ void TestVector::testPerformance()
|
||||
|
||||
QBENCHMARK
|
||||
{
|
||||
for(uint32_t ct = 0; ct < 10000000; ct++)
|
||||
for (uint32_t ct = 0; ct < 10000000; ct++)
|
||||
{
|
||||
vec = incrementVector(vec);
|
||||
}
|
||||
}
|
||||
|
||||
// Use the result so the calls don't get optimized away.
|
||||
// Use the result so the calls don't get optimized away.
|
||||
QCOMPARE(vec.lengthSquared() > 0.0f, true);
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ using namespace PolyVox;
|
||||
// make sure we get the expected result from a series of volume accesses.
|
||||
inline int32_t cantorTupleFunction(int32_t previousResult, int32_t value)
|
||||
{
|
||||
return (( previousResult + value ) * ( previousResult + value + 1 ) + value ) / 2;
|
||||
return ((previousResult + value) * (previousResult + value + 1) + value) / 2;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -60,16 +60,16 @@ int32_t testDirectAccessWithWrappingForwards(const VolumeType* volume, Region re
|
||||
for (int x = region.getLowerX(); x <= region.getUpperX(); x++)
|
||||
{
|
||||
//Three level loop now processes 27 voxel neighbourhood
|
||||
for(int innerZ = -1; innerZ <=1; innerZ++)
|
||||
for (int innerZ = -1; innerZ <= 1; innerZ++)
|
||||
{
|
||||
for(int innerY = -1; innerY <=1; innerY++)
|
||||
for (int innerY = -1; innerY <= 1; innerY++)
|
||||
{
|
||||
for(int innerX = -1; innerX <=1; innerX++)
|
||||
for (int innerX = -1; innerX <= 1; innerX++)
|
||||
{
|
||||
result = cantorTupleFunction(result, volume->getVoxel(x + innerX, y + innerY, z + innerZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//End of inner loops
|
||||
}
|
||||
}
|
||||
@@ -149,16 +149,16 @@ int32_t testDirectAccessWithWrappingBackwards(const VolumeType* volume, Region r
|
||||
for (int x = region.getUpperX(); x >= region.getLowerX(); x--)
|
||||
{
|
||||
//Three level loop now processes 27 voxel neighbourhood
|
||||
for(int innerZ = -1; innerZ <=1; innerZ++)
|
||||
for (int innerZ = -1; innerZ <= 1; innerZ++)
|
||||
{
|
||||
for(int innerY = -1; innerY <=1; innerY++)
|
||||
for (int innerY = -1; innerY <= 1; innerY++)
|
||||
{
|
||||
for(int innerX = -1; innerX <=1; innerX++)
|
||||
for (int innerX = -1; innerX <= 1; innerX++)
|
||||
{
|
||||
result = cantorTupleFunction(result, volume->getVoxel(x + innerX, y + innerY, z + innerZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//End of inner loops
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ int32_t testDirectRandomAccess(const VolumeType* volume)
|
||||
TestVolume::TestVolume()
|
||||
{
|
||||
m_regVolume = Region(-57, -31, 12, 64, 96, 131); // Deliberatly awkward size
|
||||
|
||||
|
||||
m_regInternal = m_regVolume;
|
||||
m_regInternal.shiftLowerCorner(4, 2, 2);
|
||||
m_regInternal.shiftUpperCorner(-3, -1, -2);
|
||||
|
Reference in New Issue
Block a user