Fixed paging example.

This commit is contained in:
David Williams 2013-07-31 15:49:00 +02:00
parent 4478e365c9
commit e35b58ba18

View File

@ -93,7 +93,9 @@ public:
virtual void pageIn(const PolyVox::Region& region, CompressedBlock<MaterialDensityPair44>* pBlockData)
{
/*pBlockData->createUncompressedData();
// FIXME - this isn't a great example... it's a shame we have to hard clode the block size and also create/destroy
// a compressor each time. These could at least be moved outside somewhere if we can't fix it in a better way...
UncompressedBlock<MaterialDensityPair44> block(256);
Perlin perlin(2,2,1,234);
@ -131,10 +133,15 @@ public:
// Voxel position within a block always start from zero. So if a block represents region (4, 8, 12) to (11, 19, 15)
// then the valid block voxels are from (0, 0, 0) to (7, 11, 3). Hence we subtract the lower corner position of the
// region from the volume space position in order to get the block space position.
pBlockData->setVoxelAt(x - region.getLowerX(), y - region.getLowerY(), z - region.getLowerZ(), voxel);
block.setVoxelAt(x - region.getLowerX(), y - region.getLowerY(), z - region.getLowerZ(), voxel);
}
}
}*/
}
// Now compress the computed data into the provided block.
RLEBlockCompressor<MaterialDensityPair44>* compressor = new RLEBlockCompressor<MaterialDensityPair44>();
compressor->compress(&block, pBlockData);
delete compressor;
}
virtual void pageOut(const PolyVox::Region& region, CompressedBlock<MaterialDensityPair44>* /*pBlockData*/)