From 74dfaa293fc6b6c7f5fec5a8317bad11f3b62b60 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 19 Dec 2015 15:26:20 +0000 Subject: [PATCH] Fixed usage of region which was too large for the cubic surface extractor. --- examples/Paging/main.cpp | 2 +- include/PolyVox/CubicSurfaceExtractor.inl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index 5b4bb191..56955905 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -163,7 +163,7 @@ protected: volData.prefetch(reg); std::cout << "Memory usage: " << (volData.calculateSizeInBytes() / 1024.0 / 1024.0) << "MB" << std::endl; //std::cout << "Compression ratio: 1 to " << (1.0/(volData.calculateCompressionRatio())) << std::endl; - PolyVox::Region reg2(Vector3DInt32(0, 0, 0), Vector3DInt32(255, 255, 255)); + PolyVox::Region reg2(Vector3DInt32(0, 0, 0), Vector3DInt32(254, 254, 254)); //std::cout << "Flushing region: " << reg2.getLowerCorner() << " -> " << reg2.getUpperCorner() << std::endl; //volData.flush(reg2); //std::cout << "Memory usage: " << (volData.calculateSizeInBytes() / 1024.0 / 1024.0) << "MB" << std::endl; diff --git a/include/PolyVox/CubicSurfaceExtractor.inl b/include/PolyVox/CubicSurfaceExtractor.inl index a5556f76..0444c2d3 100644 --- a/include/PolyVox/CubicSurfaceExtractor.inl +++ b/include/PolyVox/CubicSurfaceExtractor.inl @@ -29,10 +29,10 @@ namespace PolyVox CubicSurfaceExtractor::CubicSurfaceExtractor(VolumeType* volData, Region region, MeshType* result, IsQuadNeeded isQuadNeeded, bool bMergeQuads) { // This extractor has a limit as to how large the extracted region can be, because the vertex positions are encoded with a single byte per component. - int32_t maxReionDimension = 256; - POLYVOX_THROW_IF(region.getWidthInVoxels() > maxReionDimension, std::invalid_argument, "Requested extraction region exceeds maximum dimensions"); - POLYVOX_THROW_IF(region.getHeightInVoxels() > maxReionDimension, std::invalid_argument, "Requested extraction region exceeds maximum dimensions"); - POLYVOX_THROW_IF(region.getDepthInVoxels() > maxReionDimension, std::invalid_argument, "Requested extraction region exceeds maximum dimensions"); + int32_t maxReionDimensionInVoxels = 255; + POLYVOX_THROW_IF(region.getWidthInVoxels() > maxReionDimensionInVoxels, std::invalid_argument, "Requested extraction region exceeds maximum dimensions"); + POLYVOX_THROW_IF(region.getHeightInVoxels() > maxReionDimensionInVoxels, std::invalid_argument, "Requested extraction region exceeds maximum dimensions"); + POLYVOX_THROW_IF(region.getDepthInVoxels() > maxReionDimensionInVoxels, std::invalid_argument, "Requested extraction region exceeds maximum dimensions"); Timer timer; result->clear();