From 88c8c4014a05a6969fa118136936a431975bbb5e Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Thu, 22 Nov 2012 20:43:00 +0000 Subject: [PATCH] Fit off-by-one error in resampler by using available functions It still doesn't work as expected but this is a step in the right direction. --- .../include/PolyVoxCore/VolumeResampler.inl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl b/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl index 15ec0457..8469c1d3 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl @@ -81,14 +81,14 @@ namespace PolyVox template< typename SrcVolumeType, typename DstVolumeType> void VolumeResampler::resampleArbitrary() { - float srcWidth = m_regSrc.getUpperCorner().getX() - m_regSrc.getLowerCorner().getX(); - float srcHeight = m_regSrc.getUpperCorner().getY() - m_regSrc.getLowerCorner().getY(); - float srcDepth = m_regSrc.getUpperCorner().getZ() - m_regSrc.getLowerCorner().getZ(); - - float dstWidth = m_regDst.getUpperCorner().getX() - m_regDst.getLowerCorner().getX(); - float dstHeight = m_regDst.getUpperCorner().getY() - m_regDst.getLowerCorner().getY(); - float dstDepth = m_regDst.getUpperCorner().getZ() - m_regDst.getLowerCorner().getZ(); + float srcWidth = m_regSrc.getWidthInVoxels(); + float srcHeight = m_regSrc.getHeightInVoxels(); + float srcDepth = m_regSrc.getDepthInVoxels(); + float dstWidth = m_regDst.getWidthInVoxels(); + float dstHeight = m_regDst.getHeightInVoxels(); + float dstDepth = m_regDst.getDepthInVoxels(); + float fScaleX = srcWidth / dstWidth; float fScaleY = srcHeight / dstHeight; float fScaleZ = srcDepth / dstDepth;