diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index f28c54e6..27236afd 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -93,7 +93,9 @@ public: virtual void pageIn(const PolyVox::Region& region, CompressedBlock* 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 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* compressor = new RLEBlockCompressor(); + compressor->compress(&block, pBlockData); + delete compressor; } virtual void pageOut(const PolyVox::Region& region, CompressedBlock* /*pBlockData*/)