Fixed bug with RawVolume always starting coordinates at (0,0,0).

Removed Filters.h/.inl
Added Summed Area Table support to LowPassFilter.
Added test for low pass filter.
This commit is contained in:
David Williams
2011-08-13 08:57:45 +01:00
parent 03e340e7dd
commit c73b45b721
14 changed files with 308 additions and 144 deletions

View File

@ -47,6 +47,10 @@ ADD_TEST(ArrayReadWriteTest ${LATEST_TEST} testReadWrite)
CREATE_TEST(TestAStarPathfinder.h TestAStarPathfinder.cpp TestAStarPathfinder)
ADD_TEST(AStarPathfinderExecuteTest ${LATEST_TEST} testExecute)
# Low pass filter tests
CREATE_TEST(TestLowPassFilter.h TestLowPassFilter.cpp TestLowPassFilter)
ADD_TEST(LowPassFilterExecuteTest ${LATEST_TEST} testExecute)
# LargeVolume tests
CREATE_TEST(testvolume.h testvolume.cpp testvolume)
ADD_TEST(VolumeSizeTest ${LATEST_TEST} testSize)

View File

@ -0,0 +1,66 @@
/*******************************************************************************
Copyright (c) 2010 Matt Williams
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*******************************************************************************/
#include "TestLowPassFilter.h"
#include "PolyVoxCore/Density.h"
#include "PolyVoxCore/LowPassFilter.h"
#include "PolyVoxCore/RawVolume.h"
#include <QtTest>
using namespace PolyVox;
void TestLowPassFilter::testExecute()
{
const int32_t g_uVolumeSideLength = 16;
Region reg(Vector3DInt32(0,0,0), Vector3DInt32(g_uVolumeSideLength-1, g_uVolumeSideLength-1, g_uVolumeSideLength-1));
//Create empty volume
RawVolume<Density8> volData(reg);
//Create two solid walls at opposite sides of the volume
for (int32_t z = 0; z < g_uVolumeSideLength; z++)
{
for (int32_t y = 0; y < g_uVolumeSideLength; y++)
{
for (int32_t x = 0; x < g_uVolumeSideLength; x++)
{
if(x % 2 == 0)
{
Density8 voxel(32);
volData.setVoxelAt(x, y, z, voxel);
}
}
}
}
RawVolume<Density8> resultVolume(reg);
LowPassFilter<RawVolume, RawVolume, Density8> pass1(&volData, reg, &resultVolume, reg, 5);
pass1.executeSAT();
}
QTEST_MAIN(TestLowPassFilter)

37
tests/TestLowPassFilter.h Normal file
View File

@ -0,0 +1,37 @@
/*******************************************************************************
Copyright (c) 2010 Matt Williams
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*******************************************************************************/
#ifndef __PolyVox_TestLowPassFilter_H__
#define __PolyVox_TestLowPassFilter_H__
#include <QObject>
class TestLowPassFilter: public QObject
{
Q_OBJECT
private slots:
void testExecute();
};
#endif