Block now working with new MinizCompressor. Removing some old compression code.
This commit is contained in:
@ -64,7 +64,7 @@ namespace PolyVox
|
||||
void uncompress(void);
|
||||
|
||||
std::vector< RunlengthEntry<uint16_t> > m_vecCompressedData;
|
||||
uint8_t* m_pCompressedData;
|
||||
void* m_pCompressedData;
|
||||
uint32_t m_uCompressedDataLength;
|
||||
VoxelType* m_tUncompressedData;
|
||||
uint16_t m_uSideLength;
|
||||
|
@ -21,10 +21,10 @@ freely, subject to the following restrictions:
|
||||
distribution.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "PolyVoxCore/Impl/Compression.h"
|
||||
#include "PolyVoxCore/Impl/ErrorHandling.h"
|
||||
#include "PolyVoxCore/Impl/Utility.h"
|
||||
|
||||
#include "PolyVoxCore/MinizCompressor.h"
|
||||
#include "PolyVoxCore/Vector.h"
|
||||
|
||||
#include "PolyVoxCore/Impl/ErrorHandling.h"
|
||||
@ -151,14 +151,29 @@ namespace PolyVox
|
||||
//modified then we don't need to redo the compression.
|
||||
if(m_bIsUncompressedDataModified)
|
||||
{
|
||||
Data src;
|
||||
void* pSrcData = reinterpret_cast<void*>(m_tUncompressedData);
|
||||
void* pDstData = reinterpret_cast<void*>( new uint8_t[1000000] );
|
||||
uint32_t uSrcLength = m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType);
|
||||
uint32_t uDstLength = 1000000;
|
||||
|
||||
MinizCompressor compressor;
|
||||
uint32_t uCompressedLength = compressor.compress(pSrcData, uSrcLength, pDstData, uDstLength);
|
||||
|
||||
m_pCompressedData = reinterpret_cast<void*>( new uint8_t[uCompressedLength] );
|
||||
memcpy(m_pCompressedData, pDstData, uCompressedLength);
|
||||
m_uCompressedDataLength = uCompressedLength;
|
||||
|
||||
delete pDstData;
|
||||
|
||||
|
||||
/*Data src;
|
||||
src.ptr = reinterpret_cast<uint8_t*>(m_tUncompressedData);
|
||||
src.length = m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType);
|
||||
|
||||
Data compressedResult = polyvox_compress(src);
|
||||
|
||||
m_pCompressedData = compressedResult.ptr;
|
||||
m_uCompressedDataLength = compressedResult.length;
|
||||
m_uCompressedDataLength = compressedResult.length;*/
|
||||
|
||||
/*uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
|
||||
m_vecCompressedData.clear();
|
||||
@ -212,7 +227,15 @@ namespace PolyVox
|
||||
|
||||
m_tUncompressedData = new VoxelType[m_uSideLength * m_uSideLength * m_uSideLength];
|
||||
|
||||
Data src;
|
||||
void* pSrcData = reinterpret_cast<void*>(m_pCompressedData);
|
||||
void* pDstData = reinterpret_cast<void*>(m_tUncompressedData);
|
||||
uint32_t uSrcLength = m_uCompressedDataLength;
|
||||
uint32_t uDstLength = m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType);
|
||||
|
||||
MinizCompressor compressor;
|
||||
uint32_t uUncompressedLength = compressor.decompress(pSrcData, uSrcLength, pDstData, uDstLength);
|
||||
|
||||
/*Data src;
|
||||
src.ptr = m_pCompressedData;
|
||||
src.length = m_uCompressedDataLength;
|
||||
|
||||
@ -220,9 +243,9 @@ namespace PolyVox
|
||||
dst.ptr = reinterpret_cast<uint8_t*>(m_tUncompressedData);
|
||||
dst.length = m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType);
|
||||
|
||||
polyvox_decompress(src, dst);
|
||||
polyvox_decompress(src, dst);*/
|
||||
|
||||
POLYVOX_ASSERT(dst.length == m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType), "Destination length has changed.");
|
||||
POLYVOX_ASSERT(uUncompressedLength == m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType), "Destination length has changed.");
|
||||
|
||||
//m_tUncompressedData = reinterpret_cast<VoxelType*>(uncompressedResult.ptr);
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
/*******************************************************************************
|
||||
Copyright (c) 2005-2009 David 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_Compression_H__
|
||||
#define __PolyVox_Compression_H__
|
||||
|
||||
#include "PolyVoxCore/Impl/TypeDef.h"
|
||||
|
||||
struct Data
|
||||
{
|
||||
uint8_t* ptr;
|
||||
unsigned long length; // Think what type this should be.
|
||||
};
|
||||
|
||||
Data polyvox_compress(Data src);
|
||||
void polyvox_decompress(Data src, Data dst);
|
||||
|
||||
#endif //__PolyVox_Compression_H__
|
Reference in New Issue
Block a user