More work on Smooth LOD.
This commit is contained in:
@ -64,6 +64,7 @@ namespace PolyVox
|
||||
bool isEmpty(void) const;
|
||||
|
||||
void scaleVertices(float amount);
|
||||
void translateVertices(const Vector3DFloat& amount);
|
||||
|
||||
//THESE FUNCTIONS TO BE REMOVED IN THE FUTURE. OR AT LEAST MOVED OUT OF THIS CLASS INTO FREE FUNCTIONS.
|
||||
//THEY ARE CAUSING PROBLEMS WITH THE SWIG BINDINGS. THE FUNCTIONS REGARDING NORMALS MAKE NO SENSE WHEN
|
||||
|
@ -475,4 +475,16 @@ namespace PolyVox
|
||||
m_vecVertices[ct].setPosition(position);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VertexType>
|
||||
void SurfaceMesh<VertexType>::translateVertices(const Vector3DFloat& amount)
|
||||
{
|
||||
for(uint32_t ct = 0; ct < m_vecVertices.size(); ct++)
|
||||
{
|
||||
//TODO: Should rethink accessors here to provide faster access
|
||||
Vector3DFloat position = m_vecVertices[ct].getPosition();
|
||||
position += amount;
|
||||
m_vecVertices[ct].setPosition(position);
|
||||
}
|
||||
}
|
||||
}
|
@ -39,6 +39,7 @@ namespace PolyVox
|
||||
private:
|
||||
void resampleSameSize();
|
||||
void resampleHalfSize();
|
||||
void resampleArbitrary();
|
||||
|
||||
//Source data
|
||||
SrcVolumeType<VoxelType>* m_pVolSrc;
|
||||
|
@ -35,8 +35,26 @@ namespace PolyVox
|
||||
template< template<typename> class SrcVolumeType, template<typename> class DestVolumeType, typename VoxelType>
|
||||
void VolumeResampler<SrcVolumeType, DestVolumeType, VoxelType>::execute()
|
||||
{
|
||||
//resampleSameSize();
|
||||
resampleHalfSize();
|
||||
int32_t uSrcWidth = m_regSrc.getUpperCorner().getX() - m_regSrc.getLowerCorner().getX() + 1;
|
||||
int32_t uSrcHeight = m_regSrc.getUpperCorner().getY() - m_regSrc.getLowerCorner().getY() + 1;
|
||||
int32_t uSrcDepth = m_regSrc.getUpperCorner().getZ() - m_regSrc.getLowerCorner().getZ() + 1;
|
||||
|
||||
int32_t uDstWidth = m_regDst.getUpperCorner().getX() - m_regDst.getLowerCorner().getX() + 1;
|
||||
int32_t uDstHeight = m_regDst.getUpperCorner().getY() - m_regDst.getLowerCorner().getY() + 1;
|
||||
int32_t uDstDepth = m_regDst.getUpperCorner().getZ() - m_regDst.getLowerCorner().getZ() + 1;
|
||||
|
||||
if((uSrcWidth == uDstWidth) && (uSrcHeight == uDstHeight) && (uSrcDepth == uDstDepth))
|
||||
{
|
||||
resampleSameSize();
|
||||
}
|
||||
else if((uSrcWidth == uDstWidth * 2) && (uSrcHeight == uDstHeight * 2) && (uSrcDepth == uDstDepth * 2))
|
||||
{
|
||||
resampleHalfSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
resampleArbitrary();
|
||||
}
|
||||
}
|
||||
|
||||
template< template<typename> class SrcVolumeType, template<typename> class DestVolumeType, typename VoxelType>
|
||||
@ -92,4 +110,11 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template< template<typename> class SrcVolumeType, template<typename> class DestVolumeType, typename VoxelType>
|
||||
void VolumeResampler<SrcVolumeType, DestVolumeType, VoxelType>::resampleArbitrary()
|
||||
{
|
||||
//ARBITRARY RESAMPLING NOT YET IMPLEMENTED.
|
||||
assert(false);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user