Work on compression.

This commit is contained in:
Daviw Williams
2013-01-31 16:56:32 +01:00
parent a81ec68714
commit 46e38c4714
5 changed files with 30 additions and 8 deletions

View File

@ -26,7 +26,7 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Impl/TypeDef.h"
#include "PolyVoxCore/Compressor.h"
#include "PolyVoxCore/PolyVoxForwardDeclarations.h"
#include "PolyVoxCore/Vector.h"
#include <limits>

View File

@ -24,8 +24,7 @@ freely, subject to the following restrictions:
#include "PolyVoxCore/Impl/ErrorHandling.h"
#include "PolyVoxCore/Impl/Utility.h"
#include "PolyVoxCore/MinizCompressor.h"
#include "PolyVoxCore/RLECompressor.h"
#include "PolyVoxCore/Compressor.h"
#include "PolyVoxCore/Vector.h"
#include "PolyVoxCore/Impl/ErrorHandling.h"

View File

@ -17,7 +17,10 @@ namespace PolyVox
template<typename ValueType, typename LengthType>
uint32_t RLECompressor<ValueType, LengthType>::compress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength)
{
assert(uSrcLength % sizeof(ValueType) == 0);
if(uSrcLength % sizeof(ValueType) != 0)
{
POLYVOX_THROW(std::length_error, "Source length must be a integer multiple of the ValueType size");
}
uSrcLength /= sizeof(ValueType);
uDstLength /= sizeof(Run);
@ -60,7 +63,10 @@ namespace PolyVox
template<typename ValueType, typename LengthType>
uint32_t RLECompressor<ValueType, LengthType>::decompress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength)
{
assert(uSrcLength % sizeof(Run) == 0);
if(uSrcLength % sizeof(Run) != 0)
{
POLYVOX_THROW(std::length_error, "Source length must be a integer multiple of the Run size");
}
uSrcLength /= sizeof(Run);
uDstLength /= sizeof(ValueType);