Merge branch 'master' of git://gitorious.org/polyvox/polyvox
This commit is contained in:
commit
f299fc51a9
@ -10,6 +10,7 @@ SET(CORE_SRC_FILES
|
|||||||
source/Log.cpp
|
source/Log.cpp
|
||||||
source/MeshDecimator.cpp
|
source/MeshDecimator.cpp
|
||||||
source/Region.cpp
|
source/Region.cpp
|
||||||
|
source/SimpleInterface.cpp
|
||||||
source/VertexTypes.cpp
|
source/VertexTypes.cpp
|
||||||
source/VoxelFilters.cpp
|
source/VoxelFilters.cpp
|
||||||
)
|
)
|
||||||
@ -23,6 +24,9 @@ SET(CORE_INC_FILES
|
|||||||
include/PolyVoxCore/ArraySizes.h
|
include/PolyVoxCore/ArraySizes.h
|
||||||
include/PolyVoxCore/AStarPathfinder.h
|
include/PolyVoxCore/AStarPathfinder.h
|
||||||
include/PolyVoxCore/AStarPathfinder.inl
|
include/PolyVoxCore/AStarPathfinder.inl
|
||||||
|
include/PolyVoxCore/BaseVolume.h
|
||||||
|
include/PolyVoxCore/BaseVolume.inl
|
||||||
|
include/PolyVoxCore/BaseVolumeSampler.inl
|
||||||
include/PolyVoxCore/ConstVolumeProxy.h
|
include/PolyVoxCore/ConstVolumeProxy.h
|
||||||
include/PolyVoxCore/CubicSurfaceExtractor.h
|
include/PolyVoxCore/CubicSurfaceExtractor.h
|
||||||
include/PolyVoxCore/CubicSurfaceExtractor.inl
|
include/PolyVoxCore/CubicSurfaceExtractor.inl
|
||||||
@ -52,6 +56,7 @@ SET(CORE_INC_FILES
|
|||||||
include/PolyVoxCore/RaycastWithCallback.h
|
include/PolyVoxCore/RaycastWithCallback.h
|
||||||
include/PolyVoxCore/RaycastWithCallback.inl
|
include/PolyVoxCore/RaycastWithCallback.inl
|
||||||
include/PolyVoxCore/Region.h
|
include/PolyVoxCore/Region.h
|
||||||
|
include/PolyVoxCore/SimpleInterface.h
|
||||||
include/PolyVoxCore/SimpleVolume.h
|
include/PolyVoxCore/SimpleVolume.h
|
||||||
include/PolyVoxCore/SimpleVolume.inl
|
include/PolyVoxCore/SimpleVolume.inl
|
||||||
include/PolyVoxCore/SimpleVolumeBlock.inl
|
include/PolyVoxCore/SimpleVolumeBlock.inl
|
||||||
@ -63,9 +68,6 @@ SET(CORE_INC_FILES
|
|||||||
include/PolyVoxCore/Vector.h
|
include/PolyVoxCore/Vector.h
|
||||||
include/PolyVoxCore/Vector.inl
|
include/PolyVoxCore/Vector.inl
|
||||||
include/PolyVoxCore/VertexTypes.h
|
include/PolyVoxCore/VertexTypes.h
|
||||||
include/PolyVoxCore/Volume.h
|
|
||||||
include/PolyVoxCore/Volume.inl
|
|
||||||
include/PolyVoxCore/VolumeSampler.inl
|
|
||||||
include/PolyVoxCore/VolumeResampler.h
|
include/PolyVoxCore/VolumeResampler.h
|
||||||
include/PolyVoxCore/VolumeResampler.inl
|
include/PolyVoxCore/VolumeResampler.inl
|
||||||
include/PolyVoxCore/VoxelFilters.h
|
include/PolyVoxCore/VoxelFilters.h
|
||||||
|
@ -21,8 +21,8 @@ freely, subject to the following restrictions:
|
|||||||
distribution.
|
distribution.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#ifndef __PolyVox_Volume_H__
|
#ifndef __PolyVox_BaseVolume_H__
|
||||||
#define __PolyVox_Volume_H__
|
#define __PolyVox_BaseVolume_H__
|
||||||
|
|
||||||
#include "PolyVoxCore/Log.h"
|
#include "PolyVoxCore/Log.h"
|
||||||
#include "PolyVoxCore/Region.h"
|
#include "PolyVoxCore/Region.h"
|
||||||
@ -34,7 +34,7 @@ freely, subject to the following restrictions:
|
|||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
class Volume
|
class BaseVolume
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
@ -104,12 +104,12 @@ namespace PolyVox
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructor for creating a fixed size volume.
|
/// Constructor for creating a fixed size volume.
|
||||||
Volume
|
BaseVolume
|
||||||
(
|
(
|
||||||
const Region& regValid
|
const Region& regValid
|
||||||
);
|
);
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~Volume();
|
~BaseVolume();
|
||||||
|
|
||||||
/// Gets the value used for voxels which are outside the volume
|
/// Gets the value used for voxels which are outside the volume
|
||||||
VoxelType getBorderValue(void) const;
|
VoxelType getBorderValue(void) const;
|
||||||
@ -153,7 +153,7 @@ namespace PolyVox
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "PolyVoxCore/Volume.inl"
|
#include "PolyVoxCore/BaseVolume.inl"
|
||||||
#include "PolyVoxCore/VolumeSampler.inl"
|
#include "PolyVoxCore/BaseVolumeSampler.inl"
|
||||||
|
|
||||||
#endif //__PolyVox_Volume_H__
|
#endif //__PolyVox_BaseVolume_H__
|
@ -24,7 +24,7 @@ freely, subject to the following restrictions:
|
|||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
Volume<VoxelType>::Volume
|
BaseVolume<VoxelType>::BaseVolume
|
||||||
(
|
(
|
||||||
const Region& regValid
|
const Region& regValid
|
||||||
)
|
)
|
||||||
@ -36,7 +36,7 @@ namespace PolyVox
|
|||||||
/// Destroys the volume
|
/// Destroys the volume
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
Volume<VoxelType>::~Volume()
|
BaseVolume<VoxelType>::~BaseVolume()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ namespace PolyVox
|
|||||||
/// \return The value used for voxels outside of the volume
|
/// \return The value used for voxels outside of the volume
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType Volume<VoxelType>::getBorderValue(void) const
|
VoxelType BaseVolume<VoxelType>::getBorderValue(void) const
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return VoxelType();
|
return VoxelType();
|
||||||
@ -56,7 +56,7 @@ namespace PolyVox
|
|||||||
/// \return A Region representing the extent of the volume.
|
/// \return A Region representing the extent of the volume.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
Region Volume<VoxelType>::getEnclosingRegion(void) const
|
Region BaseVolume<VoxelType>::getEnclosingRegion(void) const
|
||||||
{
|
{
|
||||||
return m_regValidRegion;
|
return m_regValidRegion;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ namespace PolyVox
|
|||||||
/// \sa getHeight(), getDepth()
|
/// \sa getHeight(), getDepth()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
int32_t Volume<VoxelType>::getWidth(void) const
|
int32_t BaseVolume<VoxelType>::getWidth(void) const
|
||||||
{
|
{
|
||||||
return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1;
|
return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ namespace PolyVox
|
|||||||
/// \sa getWidth(), getDepth()
|
/// \sa getWidth(), getDepth()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
int32_t Volume<VoxelType>::getHeight(void) const
|
int32_t BaseVolume<VoxelType>::getHeight(void) const
|
||||||
{
|
{
|
||||||
return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1;
|
return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1;
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ namespace PolyVox
|
|||||||
/// \sa getWidth(), getHeight()
|
/// \sa getWidth(), getHeight()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
int32_t Volume<VoxelType>::getDepth(void) const
|
int32_t BaseVolume<VoxelType>::getDepth(void) const
|
||||||
{
|
{
|
||||||
return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1;
|
return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ namespace PolyVox
|
|||||||
/// \sa getLongestSideLength(), getDiagonalLength()
|
/// \sa getLongestSideLength(), getDiagonalLength()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
int32_t Volume<VoxelType>::getShortestSideLength(void) const
|
int32_t BaseVolume<VoxelType>::getShortestSideLength(void) const
|
||||||
{
|
{
|
||||||
return m_uShortestSideLength;
|
return m_uShortestSideLength;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ namespace PolyVox
|
|||||||
/// \sa getShortestSideLength(), getDiagonalLength()
|
/// \sa getShortestSideLength(), getDiagonalLength()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
int32_t Volume<VoxelType>::getLongestSideLength(void) const
|
int32_t BaseVolume<VoxelType>::getLongestSideLength(void) const
|
||||||
{
|
{
|
||||||
return m_uLongestSideLength;
|
return m_uLongestSideLength;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ namespace PolyVox
|
|||||||
/// \sa getShortestSideLength(), getLongestSideLength()
|
/// \sa getShortestSideLength(), getLongestSideLength()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
float Volume<VoxelType>::getDiagonalLength(void) const
|
float BaseVolume<VoxelType>::getDiagonalLength(void) const
|
||||||
{
|
{
|
||||||
return m_fDiagonalLength;
|
return m_fDiagonalLength;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ namespace PolyVox
|
|||||||
/// \return The voxel value
|
/// \return The voxel value
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType Volume<VoxelType>::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
|
VoxelType BaseVolume<VoxelType>::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return VoxelType();
|
return VoxelType();
|
||||||
@ -143,7 +143,7 @@ namespace PolyVox
|
|||||||
/// \return The voxel value
|
/// \return The voxel value
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
VoxelType Volume<VoxelType>::getVoxelAt(const Vector3DInt32& v3dPos) const
|
VoxelType BaseVolume<VoxelType>::getVoxelAt(const Vector3DInt32& v3dPos) const
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return VoxelType();
|
return VoxelType();
|
||||||
@ -153,7 +153,7 @@ namespace PolyVox
|
|||||||
/// \param tBorder The value to use for voxels outside the volume.
|
/// \param tBorder The value to use for voxels outside the volume.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
void Volume<VoxelType>::setBorderValue(const VoxelType& tBorder)
|
void BaseVolume<VoxelType>::setBorderValue(const VoxelType& tBorder)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ namespace PolyVox
|
|||||||
/// \return whether the requested position is inside the volume
|
/// \return whether the requested position is inside the volume
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
bool Volume<VoxelType>::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
|
bool BaseVolume<VoxelType>::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
@ -178,7 +178,7 @@ namespace PolyVox
|
|||||||
/// \return whether the requested position is inside the volume
|
/// \return whether the requested position is inside the volume
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
bool Volume<VoxelType>::setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue)
|
bool BaseVolume<VoxelType>::setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
@ -188,7 +188,7 @@ namespace PolyVox
|
|||||||
/// Note: This function needs reviewing for accuracy...
|
/// Note: This function needs reviewing for accuracy...
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
uint32_t Volume<VoxelType>::calculateSizeInBytes(void)
|
uint32_t BaseVolume<VoxelType>::calculateSizeInBytes(void)
|
||||||
{
|
{
|
||||||
return getWidth() * getHeight() * getDepth() * sizeof(VoxelType);
|
return getWidth() * getHeight() * getDepth() * sizeof(VoxelType);
|
||||||
}
|
}
|
@ -25,7 +25,7 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
Volume<VoxelType>::Sampler<DerivedVolumeType>::Sampler(DerivedVolumeType* volume)
|
BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::Sampler(DerivedVolumeType* volume)
|
||||||
:mVolume(volume)
|
:mVolume(volume)
|
||||||
,mXPosInVolume(0)
|
,mXPosInVolume(0)
|
||||||
,mYPosInVolume(0)
|
,mYPosInVolume(0)
|
||||||
@ -35,41 +35,41 @@ namespace PolyVox
|
|||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
Volume<VoxelType>::Sampler<DerivedVolumeType>::~Sampler()
|
BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::~Sampler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
int32_t Volume<VoxelType>::Sampler<DerivedVolumeType>::getPosX(void) const
|
int32_t BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosX(void) const
|
||||||
{
|
{
|
||||||
return mXPosInVolume;
|
return mXPosInVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
int32_t Volume<VoxelType>::Sampler<DerivedVolumeType>::getPosY(void) const
|
int32_t BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosY(void) const
|
||||||
{
|
{
|
||||||
return mYPosInVolume;
|
return mYPosInVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
int32_t Volume<VoxelType>::Sampler<DerivedVolumeType>::getPosZ(void) const
|
int32_t BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getPosZ(void) const
|
||||||
{
|
{
|
||||||
return mZPosInVolume;
|
return mZPosInVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::getVoxel(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::getVoxel(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume, mYPosInVolume, mZPosInVolume);
|
return mVolume->getVoxelAt(mXPosInVolume, mYPosInVolume, mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::setPosition(const Vector3DInt32& v3dNewPos)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::setPosition(const Vector3DInt32& v3dNewPos)
|
||||||
{
|
{
|
||||||
mXPosInVolume = v3dNewPos.getX();
|
mXPosInVolume = v3dNewPos.getX();
|
||||||
mYPosInVolume = v3dNewPos.getY();
|
mYPosInVolume = v3dNewPos.getY();
|
||||||
@ -78,7 +78,7 @@ namespace PolyVox
|
|||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::setPosition(int32_t xPos, int32_t yPos, int32_t zPos)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::setPosition(int32_t xPos, int32_t yPos, int32_t zPos)
|
||||||
{
|
{
|
||||||
mXPosInVolume = xPos;
|
mXPosInVolume = xPos;
|
||||||
mYPosInVolume = yPos;
|
mYPosInVolume = yPos;
|
||||||
@ -87,112 +87,112 @@ namespace PolyVox
|
|||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
bool Volume<VoxelType>::Sampler<DerivedVolumeType>::setVoxel(VoxelType tValue)
|
bool BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::setVoxel(VoxelType tValue)
|
||||||
{
|
{
|
||||||
return mVolume->setVoxelAt(mXPosInVolume, mYPosInVolume, mZPosInVolume, tValue);
|
return mVolume->setVoxelAt(mXPosInVolume, mYPosInVolume, mZPosInVolume, tValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveX(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveX(void)
|
||||||
{
|
{
|
||||||
mXPosInVolume++;
|
mXPosInVolume++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveY(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveY(void)
|
||||||
{
|
{
|
||||||
mYPosInVolume++;
|
mYPosInVolume++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveZ(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::movePositiveZ(void)
|
||||||
{
|
{
|
||||||
mZPosInVolume++;
|
mZPosInVolume++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeX(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeX(void)
|
||||||
{
|
{
|
||||||
mXPosInVolume--;
|
mXPosInVolume--;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeY(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeY(void)
|
||||||
{
|
{
|
||||||
mYPosInVolume--;
|
mYPosInVolume--;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
void Volume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeZ(void)
|
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::moveNegativeZ(void)
|
||||||
{
|
{
|
||||||
mZPosInVolume--;
|
mZPosInVolume--;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1ny1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1ny1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume - 1, mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume - 1, mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1ny0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1ny0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume - 1, mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume - 1, mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1ny1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1ny1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume - 1, mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume - 1, mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx0py1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx0py1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume , mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume , mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx0py0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx0py0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume , mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume , mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx0py1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx0py1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume , mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume , mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1py1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1py1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume + 1, mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume + 1, mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1py0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1py0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume + 1, mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume + 1, mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1py1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1nx1py1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume + 1, mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume - 1, mYPosInVolume + 1, mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
@ -201,63 +201,63 @@ namespace PolyVox
|
|||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1ny1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume - 1, mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume - 1, mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1ny0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume - 1, mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume - 1, mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1ny1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume - 1, mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume - 1, mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px0py1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px0py1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume , mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume , mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px0py0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px0py0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume , mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume , mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px0py1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px0py1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume , mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume , mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1py1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1py1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume + 1, mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume + 1, mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1py0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1py0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume + 1, mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume + 1, mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1py1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel0px1py1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume + 1, mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume , mYPosInVolume + 1, mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
@ -266,63 +266,63 @@ namespace PolyVox
|
|||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1ny1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume - 1, mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume - 1, mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1ny0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume - 1, mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume - 1, mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1ny1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume - 1, mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume - 1, mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px0py1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px0py1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume , mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume , mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px0py0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px0py0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume , mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume , mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px0py1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px0py1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume , mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume , mZPosInVolume + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1py1nz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1py1nz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume + 1, mZPosInVolume - 1);
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume + 1, mZPosInVolume - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1py0pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1py0pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume + 1, mZPosInVolume );
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume + 1, mZPosInVolume );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
template <typename DerivedVolumeType>
|
template <typename DerivedVolumeType>
|
||||||
VoxelType Volume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1py1pz(void) const
|
VoxelType BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::peekVoxel1px1py1pz(void) const
|
||||||
{
|
{
|
||||||
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume + 1, mZPosInVolume + 1);
|
return mVolume->getVoxelAt(mXPosInVolume + 1, mYPosInVolume + 1, mZPosInVolume + 1);
|
||||||
}
|
}
|
@ -24,11 +24,11 @@ freely, subject to the following restrictions:
|
|||||||
#ifndef __PolyVox_LargeVolume_H__
|
#ifndef __PolyVox_LargeVolume_H__
|
||||||
#define __PolyVox_LargeVolume_H__
|
#define __PolyVox_LargeVolume_H__
|
||||||
|
|
||||||
|
#include "PolyVoxCore/BaseVolume.h"
|
||||||
#include "PolyVoxImpl/Block.h"
|
#include "PolyVoxImpl/Block.h"
|
||||||
#include "PolyVoxCore/Log.h"
|
#include "PolyVoxCore/Log.h"
|
||||||
#include "PolyVoxCore/Region.h"
|
#include "PolyVoxCore/Region.h"
|
||||||
#include "PolyVoxCore/Vector.h"
|
#include "PolyVoxCore/Vector.h"
|
||||||
#include "PolyVoxCore/Volume.h"
|
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -150,7 +150,7 @@ namespace PolyVox
|
|||||||
template <typename VoxelType> class ConstVolumeProxy;
|
template <typename VoxelType> class ConstVolumeProxy;
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
class LargeVolume : public Volume<VoxelType>
|
class LargeVolume : public BaseVolume<VoxelType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//There seems to be some descrepency between Visual Studio and GCC about how the following class should be declared.
|
//There seems to be some descrepency between Visual Studio and GCC about how the following class should be declared.
|
||||||
@ -161,9 +161,9 @@ namespace PolyVox
|
|||||||
//typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences.
|
//typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences.
|
||||||
//class Sampler : public VolumeOfVoxelType::template Sampler< LargeVolume<VoxelType> >
|
//class Sampler : public VolumeOfVoxelType::template Sampler< LargeVolume<VoxelType> >
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
class Sampler : public Volume<VoxelType>::Sampler< LargeVolume<VoxelType> > //This line works on VS2010
|
class Sampler : public BaseVolume<VoxelType>::Sampler< LargeVolume<VoxelType> > //This line works on VS2010
|
||||||
#else
|
#else
|
||||||
class Sampler : public Volume<VoxelType>::template Sampler< LargeVolume<VoxelType> > //This line works on GCC
|
class Sampler : public BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> > //This line works on GCC
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -39,7 +39,7 @@ namespace PolyVox
|
|||||||
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler,
|
polyvox_function<void(const ConstVolumeProxy<VoxelType>&, const Region&)> dataOverflowHandler,
|
||||||
uint16_t uBlockSideLength
|
uint16_t uBlockSideLength
|
||||||
)
|
)
|
||||||
:Volume<VoxelType>(Region::MaxRegion)
|
:BaseVolume<VoxelType>(Region::MaxRegion)
|
||||||
{
|
{
|
||||||
m_funcDataRequiredHandler = dataRequiredHandler;
|
m_funcDataRequiredHandler = dataRequiredHandler;
|
||||||
m_funcDataOverflowHandler = dataOverflowHandler;
|
m_funcDataOverflowHandler = dataOverflowHandler;
|
||||||
@ -86,7 +86,7 @@ namespace PolyVox
|
|||||||
bool bPagingEnabled,
|
bool bPagingEnabled,
|
||||||
uint16_t uBlockSideLength
|
uint16_t uBlockSideLength
|
||||||
)
|
)
|
||||||
:Volume<VoxelType>(regValid)
|
:BaseVolume<VoxelType>(regValid)
|
||||||
{
|
{
|
||||||
m_funcDataRequiredHandler = dataRequiredHandler;
|
m_funcDataRequiredHandler = dataRequiredHandler;
|
||||||
m_funcDataOverflowHandler = dataOverflowHandler;
|
m_funcDataOverflowHandler = dataOverflowHandler;
|
||||||
|
@ -30,7 +30,7 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
LargeVolume<VoxelType>::Sampler::Sampler(LargeVolume<VoxelType>* volume)
|
LargeVolume<VoxelType>::Sampler::Sampler(LargeVolume<VoxelType>* volume)
|
||||||
:Volume<VoxelType>::template Sampler< LargeVolume<VoxelType> >(volume)
|
:BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >(volume)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ namespace PolyVox
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44;
|
typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44;
|
||||||
|
typedef MaterialDensityPair<uint16_t, 8, 8> MaterialDensityPair88;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -24,10 +24,10 @@ freely, subject to the following restrictions:
|
|||||||
#ifndef __PolyVox_RawVolume_H__
|
#ifndef __PolyVox_RawVolume_H__
|
||||||
#define __PolyVox_RawVolume_H__
|
#define __PolyVox_RawVolume_H__
|
||||||
|
|
||||||
|
#include "PolyVoxCore/BaseVolume.h"
|
||||||
#include "PolyVoxCore/Log.h"
|
#include "PolyVoxCore/Log.h"
|
||||||
#include "PolyVoxCore/Region.h"
|
#include "PolyVoxCore/Region.h"
|
||||||
#include "PolyVoxCore/Vector.h"
|
#include "PolyVoxCore/Vector.h"
|
||||||
#include "PolyVoxCore/Volume.h"
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib> //For abort()
|
#include <cstdlib> //For abort()
|
||||||
@ -38,7 +38,7 @@ freely, subject to the following restrictions:
|
|||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
class RawVolume : public Volume<VoxelType>
|
class RawVolume : public BaseVolume<VoxelType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
@ -50,9 +50,9 @@ namespace PolyVox
|
|||||||
//typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences.
|
//typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences.
|
||||||
//class Sampler : public VolumeOfVoxelType::template Sampler< RawVolume<VoxelType> >
|
//class Sampler : public VolumeOfVoxelType::template Sampler< RawVolume<VoxelType> >
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
class Sampler : public Volume<VoxelType>::Sampler< RawVolume<VoxelType> > //This line works on VS2010
|
class Sampler : public BaseVolume<VoxelType>::Sampler< RawVolume<VoxelType> > //This line works on VS2010
|
||||||
#else
|
#else
|
||||||
class Sampler : public Volume<VoxelType>::template Sampler< RawVolume<VoxelType> > //This line works on GCC
|
class Sampler : public BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> > //This line works on GCC
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +36,7 @@ namespace PolyVox
|
|||||||
(
|
(
|
||||||
const Region& regValid
|
const Region& regValid
|
||||||
)
|
)
|
||||||
:Volume<VoxelType>(regValid)
|
:BaseVolume<VoxelType>(regValid)
|
||||||
{
|
{
|
||||||
setBorderValue(VoxelType());
|
setBorderValue(VoxelType());
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
RawVolume<VoxelType>::Sampler::Sampler(RawVolume<VoxelType>* volume)
|
RawVolume<VoxelType>::Sampler::Sampler(RawVolume<VoxelType>* volume)
|
||||||
:Volume<VoxelType>::template Sampler< RawVolume<VoxelType> >(volume)
|
:BaseVolume<VoxelType>::template Sampler< RawVolume<VoxelType> >(volume)
|
||||||
,mCurrentVoxel(0)
|
,mCurrentVoxel(0)
|
||||||
,m_bIsCurrentPositionValidInX(false)
|
,m_bIsCurrentPositionValidInX(false)
|
||||||
,m_bIsCurrentPositionValidInY(false)
|
,m_bIsCurrentPositionValidInY(false)
|
||||||
|
44
library/PolyVoxCore/include/PolyVoxCore/SimpleInterface.h
Normal file
44
library/PolyVoxCore/include/PolyVoxCore/SimpleInterface.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Copyright (c) 2005-2009 David Williams
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __PolyVox_SimpleInterface_H__
|
||||||
|
#define __PolyVox_SimpleInterface_H__
|
||||||
|
|
||||||
|
#include "PolyVoxCore/CubicSurfaceExtractorWithNormals.h"
|
||||||
|
#include "PolyVoxCore/MaterialDensityPair.h"
|
||||||
|
#include "PolyVoxCore/SimpleVolume.h"
|
||||||
|
#include "PolyVoxCore/SurfaceExtractor.h"
|
||||||
|
|
||||||
|
namespace PolyVox
|
||||||
|
{
|
||||||
|
//The PolyVox simple interface only exposes one voxel type and one volume type. But if you like you can
|
||||||
|
//adjust these typedefs and rebuild the library in order to modify which one volume and voxel is exposed.
|
||||||
|
typedef SimpleVolume<MaterialDensityPair88> Volume;
|
||||||
|
typedef SurfaceMesh<PositionMaterialNormal> Mesh;
|
||||||
|
|
||||||
|
void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh);
|
||||||
|
void extractSmoothMesh(Volume& volume, const Region& region, Mesh& resultMesh);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //__PolyVox_SimpleInterface_H__
|
@ -26,10 +26,10 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#include "PolyVoxImpl/Utility.h"
|
#include "PolyVoxImpl/Utility.h"
|
||||||
|
|
||||||
|
#include "PolyVoxCore/BaseVolume.h"
|
||||||
#include "PolyVoxCore/Log.h"
|
#include "PolyVoxCore/Log.h"
|
||||||
#include "PolyVoxCore/Region.h"
|
#include "PolyVoxCore/Region.h"
|
||||||
#include "PolyVoxCore/Vector.h"
|
#include "PolyVoxCore/Vector.h"
|
||||||
#include "PolyVoxCore/Volume.h"
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib> //For abort()
|
#include <cstdlib> //For abort()
|
||||||
@ -41,7 +41,7 @@ freely, subject to the following restrictions:
|
|||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
class SimpleVolume : public Volume<VoxelType>
|
class SimpleVolume : public BaseVolume<VoxelType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
@ -76,9 +76,9 @@ namespace PolyVox
|
|||||||
//typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences.
|
//typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences.
|
||||||
//class Sampler : public VolumeOfVoxelType::template Sampler< SimpleVolume<VoxelType> >
|
//class Sampler : public VolumeOfVoxelType::template Sampler< SimpleVolume<VoxelType> >
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
class Sampler : public Volume<VoxelType>::Sampler< SimpleVolume<VoxelType> > //This line works on VS2010
|
class Sampler : public BaseVolume<VoxelType>::Sampler< SimpleVolume<VoxelType> > //This line works on VS2010
|
||||||
#else
|
#else
|
||||||
class Sampler : public Volume<VoxelType>::template Sampler< SimpleVolume<VoxelType> > //This line works on GCC
|
class Sampler : public BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> > //This line works on GCC
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -58,7 +58,7 @@ namespace PolyVox
|
|||||||
const Region& regValid,
|
const Region& regValid,
|
||||||
uint16_t uBlockSideLength
|
uint16_t uBlockSideLength
|
||||||
)
|
)
|
||||||
:Volume<VoxelType>(regValid)
|
:BaseVolume<VoxelType>(regValid)
|
||||||
{
|
{
|
||||||
//Create a volume of the right size.
|
//Create a volume of the right size.
|
||||||
resize(regValid,uBlockSideLength);
|
resize(regValid,uBlockSideLength);
|
||||||
|
@ -30,7 +30,7 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
SimpleVolume<VoxelType>::Sampler::Sampler(SimpleVolume<VoxelType>* volume)
|
SimpleVolume<VoxelType>::Sampler::Sampler(SimpleVolume<VoxelType>* volume)
|
||||||
:Volume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >(volume)
|
:BaseVolume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >(volume)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,20 +61,23 @@ namespace PolyVox
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Vector3DFloat computeCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter)
|
Vector3DFloat computeCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter)
|
||||||
{
|
{
|
||||||
uint8_t voxel1nx = volIter.peekVoxel1nx0py0pz().getDensity();
|
//FIXME - Should actually use DensityType here, both in principle and because the maths may be
|
||||||
uint8_t voxel1px = volIter.peekVoxel1px0py0pz().getDensity();
|
//faster (and to reduce casts). So it would be good to add a way to get DensityType from a voxel.
|
||||||
|
//But watch out for when the DensityType is unsigned and the difference could be negative.
|
||||||
|
float voxel1nx = static_cast<float>(volIter.peekVoxel1nx0py0pz().getDensity());
|
||||||
|
float voxel1px = static_cast<float>(volIter.peekVoxel1px0py0pz().getDensity());
|
||||||
|
|
||||||
uint8_t voxel1ny = volIter.peekVoxel0px1ny0pz().getDensity();
|
float voxel1ny = static_cast<float>(volIter.peekVoxel0px1ny0pz().getDensity());
|
||||||
uint8_t voxel1py = volIter.peekVoxel0px1py0pz().getDensity();
|
float voxel1py = static_cast<float>(volIter.peekVoxel0px1py0pz().getDensity());
|
||||||
|
|
||||||
uint8_t voxel1nz = volIter.peekVoxel0px0py1nz().getDensity();
|
float voxel1nz = static_cast<float>(volIter.peekVoxel0px0py1nz().getDensity());
|
||||||
uint8_t voxel1pz = volIter.peekVoxel0px0py1pz().getDensity();
|
float voxel1pz = static_cast<float>(volIter.peekVoxel0px0py1pz().getDensity());
|
||||||
|
|
||||||
return Vector3DFloat
|
return Vector3DFloat
|
||||||
(
|
(
|
||||||
static_cast<float>(voxel1nx) - static_cast<float>(voxel1px),
|
voxel1nx - voxel1px,
|
||||||
static_cast<float>(voxel1ny) - static_cast<float>(voxel1py),
|
voxel1ny - voxel1py,
|
||||||
static_cast<float>(voxel1nz) - static_cast<float>(voxel1pz)
|
voxel1nz - voxel1pz
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,37 +86,40 @@ namespace PolyVox
|
|||||||
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
|
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
|
||||||
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
|
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
|
||||||
|
|
||||||
const uint8_t pVoxel1nx1ny1nz = volIter.peekVoxel1nx1ny1nz().getDensity();
|
//FIXME - Should actually use DensityType here, both in principle and because the maths may be
|
||||||
const uint8_t pVoxel1nx1ny0pz = volIter.peekVoxel1nx1ny0pz().getDensity();
|
//faster (and to reduce casts). So it would be good to add a way to get DensityType from a voxel.
|
||||||
const uint8_t pVoxel1nx1ny1pz = volIter.peekVoxel1nx1ny1pz().getDensity();
|
//But watch out for when the DensityType is unsigned and the difference could be negative.
|
||||||
const uint8_t pVoxel1nx0py1nz = volIter.peekVoxel1nx0py1nz().getDensity();
|
const float pVoxel1nx1ny1nz = static_cast<float>(volIter.peekVoxel1nx1ny1nz().getDensity());
|
||||||
const uint8_t pVoxel1nx0py0pz = volIter.peekVoxel1nx0py0pz().getDensity();
|
const float pVoxel1nx1ny0pz = static_cast<float>(volIter.peekVoxel1nx1ny0pz().getDensity());
|
||||||
const uint8_t pVoxel1nx0py1pz = volIter.peekVoxel1nx0py1pz().getDensity();
|
const float pVoxel1nx1ny1pz = static_cast<float>(volIter.peekVoxel1nx1ny1pz().getDensity());
|
||||||
const uint8_t pVoxel1nx1py1nz = volIter.peekVoxel1nx1py1nz().getDensity();
|
const float pVoxel1nx0py1nz = static_cast<float>(volIter.peekVoxel1nx0py1nz().getDensity());
|
||||||
const uint8_t pVoxel1nx1py0pz = volIter.peekVoxel1nx1py0pz().getDensity();
|
const float pVoxel1nx0py0pz = static_cast<float>(volIter.peekVoxel1nx0py0pz().getDensity());
|
||||||
const uint8_t pVoxel1nx1py1pz = volIter.peekVoxel1nx1py1pz().getDensity();
|
const float pVoxel1nx0py1pz = static_cast<float>(volIter.peekVoxel1nx0py1pz().getDensity());
|
||||||
|
const float pVoxel1nx1py1nz = static_cast<float>(volIter.peekVoxel1nx1py1nz().getDensity());
|
||||||
|
const float pVoxel1nx1py0pz = static_cast<float>(volIter.peekVoxel1nx1py0pz().getDensity());
|
||||||
|
const float pVoxel1nx1py1pz = static_cast<float>(volIter.peekVoxel1nx1py1pz().getDensity());
|
||||||
|
|
||||||
const uint8_t pVoxel0px1ny1nz = volIter.peekVoxel0px1ny1nz().getDensity();
|
const float pVoxel0px1ny1nz = static_cast<float>(volIter.peekVoxel0px1ny1nz().getDensity());
|
||||||
const uint8_t pVoxel0px1ny0pz = volIter.peekVoxel0px1ny0pz().getDensity();
|
const float pVoxel0px1ny0pz = static_cast<float>(volIter.peekVoxel0px1ny0pz().getDensity());
|
||||||
const uint8_t pVoxel0px1ny1pz = volIter.peekVoxel0px1ny1pz().getDensity();
|
const float pVoxel0px1ny1pz = static_cast<float>(volIter.peekVoxel0px1ny1pz().getDensity());
|
||||||
const uint8_t pVoxel0px0py1nz = volIter.peekVoxel0px0py1nz().getDensity();
|
const float pVoxel0px0py1nz = static_cast<float>(volIter.peekVoxel0px0py1nz().getDensity());
|
||||||
//const uint8_t pVoxel0px0py0pz = volIter.peekVoxel0px0py0pz().getDensity();
|
//const float pVoxel0px0py0pz = static_cast<float>(volIter.peekVoxel0px0py0pz().getDensity());
|
||||||
const uint8_t pVoxel0px0py1pz = volIter.peekVoxel0px0py1pz().getDensity();
|
const float pVoxel0px0py1pz = static_cast<float>(volIter.peekVoxel0px0py1pz().getDensity());
|
||||||
const uint8_t pVoxel0px1py1nz = volIter.peekVoxel0px1py1nz().getDensity();
|
const float pVoxel0px1py1nz = static_cast<float>(volIter.peekVoxel0px1py1nz().getDensity());
|
||||||
const uint8_t pVoxel0px1py0pz = volIter.peekVoxel0px1py0pz().getDensity();
|
const float pVoxel0px1py0pz = static_cast<float>(volIter.peekVoxel0px1py0pz().getDensity());
|
||||||
const uint8_t pVoxel0px1py1pz = volIter.peekVoxel0px1py1pz().getDensity();
|
const float pVoxel0px1py1pz = static_cast<float>(volIter.peekVoxel0px1py1pz().getDensity());
|
||||||
|
|
||||||
const uint8_t pVoxel1px1ny1nz = volIter.peekVoxel1px1ny1nz().getDensity();
|
const float pVoxel1px1ny1nz = static_cast<float>(volIter.peekVoxel1px1ny1nz().getDensity());
|
||||||
const uint8_t pVoxel1px1ny0pz = volIter.peekVoxel1px1ny0pz().getDensity();
|
const float pVoxel1px1ny0pz = static_cast<float>(volIter.peekVoxel1px1ny0pz().getDensity());
|
||||||
const uint8_t pVoxel1px1ny1pz = volIter.peekVoxel1px1ny1pz().getDensity();
|
const float pVoxel1px1ny1pz = static_cast<float>(volIter.peekVoxel1px1ny1pz().getDensity());
|
||||||
const uint8_t pVoxel1px0py1nz = volIter.peekVoxel1px0py1nz().getDensity();
|
const float pVoxel1px0py1nz = static_cast<float>(volIter.peekVoxel1px0py1nz().getDensity());
|
||||||
const uint8_t pVoxel1px0py0pz = volIter.peekVoxel1px0py0pz().getDensity();
|
const float pVoxel1px0py0pz = static_cast<float>(volIter.peekVoxel1px0py0pz().getDensity());
|
||||||
const uint8_t pVoxel1px0py1pz = volIter.peekVoxel1px0py1pz().getDensity();
|
const float pVoxel1px0py1pz = static_cast<float>(volIter.peekVoxel1px0py1pz().getDensity());
|
||||||
const uint8_t pVoxel1px1py1nz = volIter.peekVoxel1px1py1nz().getDensity();
|
const float pVoxel1px1py1nz = static_cast<float>(volIter.peekVoxel1px1py1nz().getDensity());
|
||||||
const uint8_t pVoxel1px1py0pz = volIter.peekVoxel1px1py0pz().getDensity();
|
const float pVoxel1px1py0pz = static_cast<float>(volIter.peekVoxel1px1py0pz().getDensity());
|
||||||
const uint8_t pVoxel1px1py1pz = volIter.peekVoxel1px1py1pz().getDensity();
|
const float pVoxel1px1py1pz = static_cast<float>(volIter.peekVoxel1px1py1pz().getDensity());
|
||||||
|
|
||||||
const int xGrad(- weights[0][0][0] * pVoxel1nx1ny1nz -
|
const float xGrad(- weights[0][0][0] * pVoxel1nx1ny1nz -
|
||||||
weights[1][0][0] * pVoxel1nx1ny0pz - weights[2][0][0] *
|
weights[1][0][0] * pVoxel1nx1ny0pz - weights[2][0][0] *
|
||||||
pVoxel1nx1ny1pz - weights[0][1][0] * pVoxel1nx0py1nz -
|
pVoxel1nx1ny1pz - weights[0][1][0] * pVoxel1nx0py1nz -
|
||||||
weights[1][1][0] * pVoxel1nx0py0pz - weights[2][1][0] *
|
weights[1][1][0] * pVoxel1nx0py0pz - weights[2][1][0] *
|
||||||
@ -127,7 +133,7 @@ namespace PolyVox
|
|||||||
weights[1][2][2] * pVoxel1px1py0pz + weights[2][2][2] *
|
weights[1][2][2] * pVoxel1px1py0pz + weights[2][2][2] *
|
||||||
pVoxel1px1py1pz);
|
pVoxel1px1py1pz);
|
||||||
|
|
||||||
const int yGrad(- weights[0][0][0] * pVoxel1nx1ny1nz -
|
const float yGrad(- weights[0][0][0] * pVoxel1nx1ny1nz -
|
||||||
weights[1][0][0] * pVoxel1nx1ny0pz - weights[2][0][0] *
|
weights[1][0][0] * pVoxel1nx1ny0pz - weights[2][0][0] *
|
||||||
pVoxel1nx1ny1pz + weights[0][2][0] * pVoxel1nx1py1nz +
|
pVoxel1nx1ny1pz + weights[0][2][0] * pVoxel1nx1py1nz +
|
||||||
weights[1][2][0] * pVoxel1nx1py0pz + weights[2][2][0] *
|
weights[1][2][0] * pVoxel1nx1py0pz + weights[2][2][0] *
|
||||||
@ -141,7 +147,7 @@ namespace PolyVox
|
|||||||
weights[1][2][2] * pVoxel1px1py0pz + weights[2][2][2] *
|
weights[1][2][2] * pVoxel1px1py0pz + weights[2][2][2] *
|
||||||
pVoxel1px1py1pz);
|
pVoxel1px1py1pz);
|
||||||
|
|
||||||
const int zGrad(- weights[0][0][0] * pVoxel1nx1ny1nz +
|
const float zGrad(- weights[0][0][0] * pVoxel1nx1ny1nz +
|
||||||
weights[2][0][0] * pVoxel1nx1ny1pz - weights[0][1][0] *
|
weights[2][0][0] * pVoxel1nx1ny1pz - weights[0][1][0] *
|
||||||
pVoxel1nx0py1nz + weights[2][1][0] * pVoxel1nx0py1pz -
|
pVoxel1nx0py1nz + weights[2][1][0] * pVoxel1nx0py1pz -
|
||||||
weights[0][2][0] * pVoxel1nx1py1nz + weights[2][2][0] *
|
weights[0][2][0] * pVoxel1nx1py1nz + weights[2][2][0] *
|
||||||
@ -157,7 +163,7 @@ namespace PolyVox
|
|||||||
|
|
||||||
//Note: The above actually give gradients going from low density to high density.
|
//Note: The above actually give gradients going from low density to high density.
|
||||||
//For our normals we want the the other way around, so we switch the components as we return them.
|
//For our normals we want the the other way around, so we switch the components as we return them.
|
||||||
return Vector3DFloat(static_cast<float>(-xGrad),static_cast<float>(-yGrad),static_cast<float>(-zGrad));
|
return Vector3DFloat(-xGrad,-yGrad,-zGrad);
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// End of compiler bug workaroumd.
|
// End of compiler bug workaroumd.
|
||||||
|
39
library/PolyVoxCore/source/SimpleInterface.cpp
Normal file
39
library/PolyVoxCore/source/SimpleInterface.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
Copyright (c) 2005-2009 David Williams
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "PolyVoxCore/SimpleInterface.h"
|
||||||
|
|
||||||
|
namespace PolyVox
|
||||||
|
{
|
||||||
|
void extractCubicMesh(Volume& volume, const Region& region, Mesh& resultMesh)
|
||||||
|
{
|
||||||
|
CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair88 > surfaceExtractor(&volume, region, &resultMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void extractSmoothMesh(Volume& volume, const Region& region, Mesh& resultMesh)
|
||||||
|
{
|
||||||
|
SurfaceExtractor<SimpleVolume, MaterialDensityPair88 > surfaceExtractor(&volume, region, &resultMesh);
|
||||||
|
surfaceExtractor.execute();
|
||||||
|
}
|
||||||
|
}
|
@ -24,25 +24,35 @@ freely, subject to the following restrictions:
|
|||||||
#include "TestVolumeSubclass.h"
|
#include "TestVolumeSubclass.h"
|
||||||
|
|
||||||
#include "PolyVoxCore/Array.h"
|
#include "PolyVoxCore/Array.h"
|
||||||
|
#include "PolyVoxCore/BaseVolume.h"
|
||||||
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
||||||
#include "PolyVoxCore/Material.h"
|
#include "PolyVoxCore/Material.h"
|
||||||
#include "PolyVoxCore/Vector.h"
|
#include "PolyVoxCore/Vector.h"
|
||||||
#include "PolyVoxCore/Volume.h"
|
|
||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
using namespace PolyVox;
|
using namespace PolyVox;
|
||||||
|
|
||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
class VolumeSubclass : public Volume<VoxelType>
|
class VolumeSubclass : public BaseVolume<VoxelType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Volume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences. See http://goo.gl/qu1wn
|
//There seems to be some descrepency between Visual Studio and GCC about how the following class should be declared.
|
||||||
class Sampler : public VolumeOfVoxelType::template Sampler< VolumeSubclass<VoxelType> >
|
//There is a work around (see also See http://goo.gl/qu1wn) given below which appears to work on VS2010 and GCC, but
|
||||||
|
//which seems to cause internal compiler errors on VS2008 when building with the /Gm 'Enable Minimal Rebuild' compiler
|
||||||
|
//option. For now it seems best to 'fix' it with the preprocessor insstead, but maybe the workaround can be reinstated
|
||||||
|
//in the future
|
||||||
|
//typedef BaseVolume<VoxelType> VolumeOfVoxelType; //Workaround for GCC/VS2010 differences. See http://goo.gl/qu1wn
|
||||||
|
//class Sampler : public VolumeOfVoxelType::template Sampler< VolumeSubclass<VoxelType> >
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
class Sampler : public BaseVolume<VoxelType>::Sampler< VolumeSubclass<VoxelType> > //This line works on VS2010
|
||||||
|
#else
|
||||||
|
class Sampler : public BaseVolume<VoxelType>::template Sampler< VolumeSubclass<VoxelType> > //This line works on GCC
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sampler(VolumeSubclass<VoxelType>* volume)
|
Sampler(VolumeSubclass<VoxelType>* volume)
|
||||||
:Volume<VoxelType>::template Sampler< VolumeSubclass<VoxelType> >(volume)
|
:BaseVolume<VoxelType>::template Sampler< VolumeSubclass<VoxelType> >(volume)
|
||||||
{
|
{
|
||||||
this->mVolume = volume;
|
this->mVolume = volume;
|
||||||
}
|
}
|
||||||
@ -51,7 +61,7 @@ public:
|
|||||||
|
|
||||||
/// Constructor for creating a fixed size volume.
|
/// Constructor for creating a fixed size volume.
|
||||||
VolumeSubclass(const Region& regValid)
|
VolumeSubclass(const Region& regValid)
|
||||||
:Volume<VoxelType>(regValid)
|
:BaseVolume<VoxelType>(regValid)
|
||||||
{
|
{
|
||||||
mVolumeData.resize(ArraySizes(this->getWidth())(this->getHeight())(this->getDepth()));
|
mVolumeData.resize(ArraySizes(this->getWidth())(this->getHeight())(this->getDepth()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user