Merge branch 'develop' into feature/cubiquity-version
This commit is contained in:
commit
aab1149e8f
@ -84,14 +84,14 @@ class PerlinNoisePager : public PolyVox::Pager<MaterialDensityPair44>
|
|||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
PerlinNoisePager()
|
PerlinNoisePager()
|
||||||
:Pager()
|
:Pager<MaterialDensityPair44>()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~PerlinNoisePager() {};
|
virtual ~PerlinNoisePager() {};
|
||||||
|
|
||||||
virtual void pageIn(const Region& region, Block<MaterialDensityPair44>* pBlockData)
|
virtual void pageIn(const PolyVox::Region& region, Block<MaterialDensityPair44>* pBlockData)
|
||||||
{
|
{
|
||||||
pBlockData->createUncompressedData();
|
pBlockData->createUncompressedData();
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void pageOut(const Region& region, Block<MaterialDensityPair44>* pBlockData)
|
virtual void pageOut(const PolyVox::Region& region, Block<MaterialDensityPair44>* pBlockData)
|
||||||
{
|
{
|
||||||
std::cout << "warning unloading region: " << region.getLowerCorner() << " -> " << region.getUpperCorner() << std::endl;
|
std::cout << "warning unloading region: " << region.getLowerCorner() << " -> " << region.getUpperCorner() << std::endl;
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
RLECompressor<MaterialDensityPair44, uint16_t>* compressor = new RLECompressor<MaterialDensityPair44, uint16_t>();
|
RLECompressor<MaterialDensityPair44, uint16_t>* compressor = new RLECompressor<MaterialDensityPair44, uint16_t>();
|
||||||
PerlinNoisePager* pager = new PerlinNoisePager();
|
PerlinNoisePager* pager = new PerlinNoisePager();
|
||||||
LargeVolume<MaterialDensityPair44> volData(Region::MaxRegion, compressor, pager, 256);
|
LargeVolume<MaterialDensityPair44> volData(PolyVox::Region::MaxRegion, compressor, pager, 256);
|
||||||
volData.setMaxNumberOfBlocksInMemory(4096);
|
volData.setMaxNumberOfBlocksInMemory(4096);
|
||||||
volData.setMaxNumberOfUncompressedBlocks(64);
|
volData.setMaxNumberOfUncompressedBlocks(64);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ freely, subject to the following restrictions:
|
|||||||
#include "PolyVoxCore/Impl/TypeDef.h"
|
#include "PolyVoxCore/Impl/TypeDef.h"
|
||||||
|
|
||||||
#include "PolyVoxCore/Pager.h"
|
#include "PolyVoxCore/Pager.h"
|
||||||
|
#include "PolyVoxCore/Region.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -38,12 +39,12 @@ namespace PolyVox
|
|||||||
* Provides an interface for performing paging of data.
|
* Provides an interface for performing paging of data.
|
||||||
*/
|
*/
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
class FilePager : public Pager<typename VoxelType>
|
class FilePager : public Pager<VoxelType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FilePager(const std::string& strFolderName)
|
FilePager(const std::string& strFolderName)
|
||||||
:Pager()
|
:Pager<VoxelType>()
|
||||||
,m_strFolderName(strFolderName)
|
,m_strFolderName(strFolderName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -619,9 +619,7 @@ namespace PolyVox
|
|||||||
// create the new block
|
// create the new block
|
||||||
Block<VoxelType> newBlock(m_uBlockSideLength, m_pCompressor);
|
Block<VoxelType> newBlock(m_uBlockSideLength, m_pCompressor);
|
||||||
|
|
||||||
auto retVal = m_pBlocks.insert(std::make_pair(v3dBlockPos, newBlock));
|
itBlock = m_pBlocks.insert(std::make_pair(v3dBlockPos, newBlock)).first;
|
||||||
itBlock = retVal.first;
|
|
||||||
POLYVOX_ASSERT(retVal.second == true, "Element was not supposed to exist!");
|
|
||||||
|
|
||||||
//We have created the new block. If paging is enabled it should be used to
|
//We have created the new block. If paging is enabled it should be used to
|
||||||
//fill in the required data. Otherwise it is just left in the default state.
|
//fill in the required data. Otherwise it is just left in the default state.
|
||||||
|
@ -86,6 +86,11 @@ namespace PolyVox
|
|||||||
typedef DensityU8 Density8; //Backwards compatibility
|
typedef DensityU8 Density8; //Backwards compatibility
|
||||||
typedef DensityU16 Density16; //Backwards compatibility
|
typedef DensityU16 Density16; //Backwards compatibility
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// FilePager
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template <typename VoxelType> class FilePager;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// LargeVolume
|
// LargeVolume
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -112,6 +117,11 @@ namespace PolyVox
|
|||||||
typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44;
|
typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44;
|
||||||
typedef MaterialDensityPair<uint16_t, 8, 8> MaterialDensityPair88;
|
typedef MaterialDensityPair<uint16_t, 8, 8> MaterialDensityPair88;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Pager
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
template <typename VoxelType> class Pager;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// PositionMaterial
|
// PositionMaterial
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
6
library/bindings/FilePager.i
Normal file
6
library/bindings/FilePager.i
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
%module FilePager
|
||||||
|
%{
|
||||||
|
#include "FilePager.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "FilePager.h"
|
6
library/bindings/Pager.i
Normal file
6
library/bindings/Pager.i
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
%module Pager
|
||||||
|
%{
|
||||||
|
#include "Pager.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "Pager.h"
|
@ -76,6 +76,8 @@ EXTRACTOR(shortname, LargeVolume)
|
|||||||
%include "DefaultMarchingCubesController.i"
|
%include "DefaultMarchingCubesController.i"
|
||||||
%include "Region.i"
|
%include "Region.i"
|
||||||
%include "Compressor.i"
|
%include "Compressor.i"
|
||||||
|
%include "Pager.i"
|
||||||
|
%include "FilePager.i"
|
||||||
%include "MinizCompressor.i"
|
%include "MinizCompressor.i"
|
||||||
%include "RLECompressor.i"
|
%include "RLECompressor.i"
|
||||||
%include "BaseVolume.i"
|
%include "BaseVolume.i"
|
||||||
|
@ -23,6 +23,7 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#include "testvolume.h"
|
#include "testvolume.h"
|
||||||
|
|
||||||
|
#include "PolyVoxCore/FilePager.h"
|
||||||
#include "PolyVoxCore/LargeVolume.h"
|
#include "PolyVoxCore/LargeVolume.h"
|
||||||
#include "PolyVoxCore/MinizCompressor.h"
|
#include "PolyVoxCore/MinizCompressor.h"
|
||||||
#include "PolyVoxCore/RawVolume.h"
|
#include "PolyVoxCore/RawVolume.h"
|
||||||
@ -273,15 +274,15 @@ TestVolume::TestVolume()
|
|||||||
|
|
||||||
//m_pCompressor = new RLECompressor<int32_t, uint16_t>;
|
//m_pCompressor = new RLECompressor<int32_t, uint16_t>;
|
||||||
m_pCompressor = new MinizCompressor;
|
m_pCompressor = new MinizCompressor;
|
||||||
|
m_pFilePager = new FilePager<int32_t>("./");
|
||||||
|
|
||||||
//Create the volumes
|
//Create the volumes
|
||||||
m_pRawVolume = new RawVolume<int32_t>(region);
|
m_pRawVolume = new RawVolume<int32_t>(region);
|
||||||
m_pSimpleVolume = new SimpleVolume<int32_t>(region);
|
m_pSimpleVolume = new SimpleVolume<int32_t>(region);
|
||||||
m_pLargeVolume = new LargeVolume<int32_t>(region, m_pCompressor, 0, 32);
|
m_pLargeVolume = new LargeVolume<int32_t>(region, m_pCompressor, m_pFilePager, 32);
|
||||||
|
|
||||||
// LargeVolume currently fails a test if compression is enabled. It
|
m_pLargeVolume->setMaxNumberOfBlocksInMemory(32);
|
||||||
// may be related to accessing the data through more than one sampler?
|
m_pLargeVolume->setMaxNumberOfUncompressedBlocks(16);
|
||||||
//m_pLargeVolume->setCompressionEnabled(false);
|
|
||||||
|
|
||||||
//Fill the volume with some data
|
//Fill the volume with some data
|
||||||
for(int z = region.getLowerZ(); z <= region.getUpperZ(); z++)
|
for(int z = region.getLowerZ(); z <= region.getUpperZ(); z++)
|
||||||
@ -305,6 +306,7 @@ TestVolume::~TestVolume()
|
|||||||
delete m_pSimpleVolume;
|
delete m_pSimpleVolume;
|
||||||
delete m_pLargeVolume;
|
delete m_pLargeVolume;
|
||||||
|
|
||||||
|
delete m_pFilePager;
|
||||||
delete m_pCompressor;
|
delete m_pCompressor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,8 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PolyVox::Compressor* m_pCompressor;
|
PolyVox::Compressor* m_pCompressor;
|
||||||
|
PolyVox::FilePager<int32_t>* m_pFilePager;
|
||||||
|
|
||||||
PolyVox::RawVolume<int32_t>* m_pRawVolume;
|
PolyVox::RawVolume<int32_t>* m_pRawVolume;
|
||||||
PolyVox::SimpleVolume<int32_t>* m_pSimpleVolume;
|
PolyVox::SimpleVolume<int32_t>* m_pSimpleVolume;
|
||||||
PolyVox::LargeVolume<int32_t>* m_pLargeVolume;
|
PolyVox::LargeVolume<int32_t>* m_pLargeVolume;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user