Bit renaming. Old Array class is gone, and is replaced by the Array2D class which has also been renamed to Array.
This commit is contained in:
@ -68,7 +68,7 @@ void TestAmbientOcclusionGenerator::testExecute()
|
||||
|
||||
//Create an array to store the result. Array can be smaller than the volume by an integer amount.
|
||||
const int32_t g_uArraySideLength = g_uVolumeSideLength / 2;
|
||||
Array<3, uint8_t> ambientOcclusionResult(ArraySizes(g_uArraySideLength)(g_uArraySideLength)(g_uArraySideLength));
|
||||
Array<3, uint8_t> ambientOcclusionResult(g_uArraySideLength, g_uArraySideLength, g_uArraySideLength);
|
||||
|
||||
// Calculate the ambient occlusion values
|
||||
IsVoxelTransparent isVoxelTransparent;
|
||||
@ -78,11 +78,11 @@ void TestAmbientOcclusionGenerator::testExecute()
|
||||
|
||||
//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);
|
||||
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, volData.getEnclosingRegion(), 32.0f, 8, &isVoxelTransparentFunction);
|
||||
|
@ -25,8 +25,6 @@ freely, subject to the following restrictions:
|
||||
|
||||
#include "PolyVoxCore/Array.h"
|
||||
|
||||
#include "PolyVoxCore/Impl/Array2D.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
using namespace PolyVox;
|
||||
@ -64,34 +62,7 @@ void TestArray::testPolyVoxArraySpeed()
|
||||
const int height = 32;
|
||||
const int depth = 32;
|
||||
|
||||
Array<3, int> polyvoxArray(ArraySizes(width)(height)(depth));
|
||||
|
||||
QBENCHMARK
|
||||
{
|
||||
int ct = 1;
|
||||
int expectedTotal = 0;
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
polyvoxArray[x][y][z] = ct;
|
||||
expectedTotal += polyvoxArray[x][y][z];
|
||||
ct++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestArray::testPolyVoxArray2DSpeed()
|
||||
{
|
||||
const int width = 32;
|
||||
const int height = 32;
|
||||
const int depth = 32;
|
||||
|
||||
Array2D<3, int> polyvoxArray(width, height, depth);
|
||||
Array<3, int> polyvoxArray(width, height, depth);
|
||||
|
||||
QBENCHMARK
|
||||
{
|
||||
@ -118,7 +89,7 @@ void TestArray::testReadWrite()
|
||||
int height = 10;
|
||||
int depth = 20;
|
||||
|
||||
Array<3, int> myArray(ArraySizes(width)(height)(depth));
|
||||
Array<3, int> myArray(width, height, depth);
|
||||
|
||||
int ct = 1;
|
||||
int expectedTotal = 0;
|
||||
@ -128,8 +99,8 @@ void TestArray::testReadWrite()
|
||||
{
|
||||
for(int x = 0; x < width; x++)
|
||||
{
|
||||
myArray[x][y][z] = ct;
|
||||
expectedTotal += myArray[x][y][z];
|
||||
myArray(x, y, z) = ct;
|
||||
expectedTotal += myArray(x, y, z);
|
||||
ct++;
|
||||
}
|
||||
}
|
||||
@ -143,8 +114,8 @@ void TestArray::testReadWrite()
|
||||
{
|
||||
for(int x = 0; x < width; x++)
|
||||
{
|
||||
QCOMPARE(myArray[x][y][z], ct);
|
||||
total += myArray[x][y][z];
|
||||
QCOMPARE(myArray(x, y, z), ct);
|
||||
total += myArray(x, y, z);
|
||||
ct++;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ class TestArray: public QObject
|
||||
private slots:
|
||||
void testCArraySpeed();
|
||||
void testPolyVoxArraySpeed();
|
||||
void testPolyVoxArray2DSpeed();
|
||||
void testReadWrite();
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ freely, subject to the following restrictions:
|
||||
|
||||
#include "TestVolumeSubclass.h"
|
||||
|
||||
#include "PolyVoxCore/Impl/Array2D.h"
|
||||
#include "PolyVoxCore/Array.h"
|
||||
|
||||
#include "PolyVoxCore/BaseVolume.h"
|
||||
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
||||
@ -167,7 +167,7 @@ public:
|
||||
//void resize(const Region& regValidRegion);
|
||||
|
||||
private:
|
||||
Array2D<3, VoxelType> mVolumeData;
|
||||
Array<3, VoxelType> mVolumeData;
|
||||
};
|
||||
|
||||
void TestVolumeSubclass::testExtractSurface()
|
||||
|
Reference in New Issue
Block a user