Material/Density types are no longer exposed on voxels. This is because primitive types don't have them anyway.
This commit is contained in:
parent
7189abb603
commit
2fbe418259
@ -47,19 +47,13 @@ namespace PolyVox
|
||||
class Density
|
||||
{
|
||||
public:
|
||||
//We expose DensityType and MaterialType in this way so that, when code is
|
||||
//templatised on voxel type, it can determine the underlying storage type
|
||||
//using code such as 'VoxelType::DensityType value = voxel.getDensity()'
|
||||
//or 'VoxelType::MaterialType value = voxel.getMaterial()'.
|
||||
typedef Type DensityType;
|
||||
typedef int32_t MaterialType; //Shouldn't define this one...
|
||||
|
||||
/// Constructor
|
||||
Density() : m_uDensity(0) {}
|
||||
|
||||
/// Copy constructor
|
||||
Density(DensityType uDensity) : m_uDensity(uDensity) {}
|
||||
Density(Type uDensity) : m_uDensity(uDensity) {}
|
||||
|
||||
// The LowPassFilter uses this to convert between normal and accumulated types.
|
||||
/// Copy constructor with cast
|
||||
template <typename CastType> explicit Density(const Density<CastType>& density) throw()
|
||||
{
|
||||
@ -98,14 +92,14 @@ namespace PolyVox
|
||||
return *this;
|
||||
}
|
||||
|
||||
DensityType getDensity() const throw() { return m_uDensity; }
|
||||
void setDensity(DensityType uDensity) { m_uDensity = uDensity; }
|
||||
Type getDensity() const throw() { return m_uDensity; }
|
||||
void setDensity(Type uDensity) { m_uDensity = uDensity; }
|
||||
|
||||
static DensityType getMaxDensity() throw() { return (std::numeric_limits<DensityType>::max)(); }
|
||||
static DensityType getMinDensity() throw() { return (std::numeric_limits<DensityType>::min)(); }
|
||||
static Type getMaxDensity() throw() { return (std::numeric_limits<Type>::max)(); }
|
||||
static Type getMinDensity() throw() { return (std::numeric_limits<Type>::min)(); }
|
||||
|
||||
private:
|
||||
DensityType m_uDensity;
|
||||
Type m_uDensity;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
|
@ -34,14 +34,7 @@ namespace PolyVox
|
||||
{
|
||||
///This class represents a voxel storing only a material.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// In order to perform a surface extraction on a LargeVolume, PolyVox needs the underlying
|
||||
/// voxel type to provide both getDensity() and getMaterial() functions. The getDensity()
|
||||
/// function is used to determine if a voxel is 'solid', and if it is then the getMaterial()
|
||||
/// funtion is used to determine what material should be assigned to the resulting mesh.
|
||||
///
|
||||
/// This class meets these requirements, although it only actually stores a material value.
|
||||
/// For the getDensity() function it simply returns the smallest possible density if the
|
||||
/// material is zero and the largest possible density if the material is not zero.
|
||||
/// Detailed description...
|
||||
///
|
||||
/// \sa Density, MaterialDensityPair
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -52,15 +45,8 @@ namespace PolyVox
|
||||
class Material
|
||||
{
|
||||
public:
|
||||
//We expose DensityType and MaterialType in this way so that, when code is
|
||||
//templatised on voxel type, it can determine the underlying storage type
|
||||
//using code such as 'VoxelType::DensityType value = voxel.getDensity()'
|
||||
//or 'VoxelType::MaterialType value = voxel.getMaterial()'.
|
||||
typedef int32_t DensityType;
|
||||
typedef Type MaterialType;
|
||||
|
||||
Material() : m_uMaterial(0) {}
|
||||
Material(MaterialType uMaterial) : m_uMaterial(uMaterial) {}
|
||||
Material(Type uMaterial) : m_uMaterial(uMaterial) {}
|
||||
|
||||
bool operator==(const Material& rhs) const throw()
|
||||
{
|
||||
@ -72,11 +58,11 @@ namespace PolyVox
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
MaterialType getMaterial() const throw() { return m_uMaterial; }
|
||||
void setMaterial(MaterialType uMaterial) { m_uMaterial = uMaterial; }
|
||||
Type getMaterial() const throw() { return m_uMaterial; }
|
||||
void setMaterial(Type uMaterial) { m_uMaterial = uMaterial; }
|
||||
|
||||
private:
|
||||
MaterialType m_uMaterial;
|
||||
Type m_uMaterial;
|
||||
};
|
||||
|
||||
typedef Material<uint8_t> Material8;
|
||||
|
@ -33,15 +33,7 @@ namespace PolyVox
|
||||
{
|
||||
/// This class represents a voxel storing only a density.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// In order to perform a surface extraction on a LargeVolume, PolyVox needs the underlying
|
||||
/// voxel type to provide both getDensity() and getMaterial() functions. The getDensity()
|
||||
/// function is used to determine if a voxel is 'solid', and if it is then the getMaterial()
|
||||
/// funtion is used to determine what material should be assigned to the resulting mesh.
|
||||
///
|
||||
/// This class meets these requirements, and does so by storing and returning both a material
|
||||
/// and a density value. Via the template parameters it is possible to control how much
|
||||
/// precision is given to each. For example, if you create a class with 8 bits of storage,
|
||||
/// you might choose to allocate 6 bits for the density and 2 bits for the material.
|
||||
/// Detailed description...
|
||||
///
|
||||
/// \sa Density, Material
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -49,13 +41,6 @@ namespace PolyVox
|
||||
class MaterialDensityPair
|
||||
{
|
||||
public:
|
||||
//We expose DensityType and MaterialType in this way so that, when code is
|
||||
//templatised on voxel type, it can determine the underlying storage type
|
||||
//using code such as 'VoxelType::DensityType value = voxel.getDensity()'
|
||||
//or 'VoxelType::MaterialType value = voxel.getMaterial()'.
|
||||
typedef Type DensityType;
|
||||
typedef Type MaterialType;
|
||||
|
||||
MaterialDensityPair() : m_uMaterial(0), m_uDensity(0) {}
|
||||
MaterialDensityPair(Type uMaterial, Type uDensity) : m_uMaterial(uMaterial), m_uDensity(uDensity) {}
|
||||
|
||||
@ -87,18 +72,18 @@ namespace PolyVox
|
||||
return *this;
|
||||
}
|
||||
|
||||
DensityType getDensity() const throw() { return m_uDensity; }
|
||||
MaterialType getMaterial() const throw() { return m_uMaterial; }
|
||||
Type getDensity() const throw() { return m_uDensity; }
|
||||
Type getMaterial() const throw() { return m_uMaterial; }
|
||||
|
||||
void setDensity(DensityType uDensity) { m_uDensity = uDensity; }
|
||||
void setMaterial(MaterialType uMaterial) { m_uMaterial = uMaterial; }
|
||||
void setDensity(Type uDensity) { m_uDensity = uDensity; }
|
||||
void setMaterial(Type uMaterial) { m_uMaterial = uMaterial; }
|
||||
|
||||
static DensityType getMaxDensity() throw() { return (0x01 << NoOfDensityBits) - 1; }
|
||||
static DensityType getMinDensity() throw() { return 0; }
|
||||
static Type getMaxDensity() throw() { return (0x01 << NoOfDensityBits) - 1; }
|
||||
static Type getMinDensity() throw() { return 0; }
|
||||
|
||||
private:
|
||||
MaterialType m_uMaterial : NoOfMaterialBits;
|
||||
DensityType m_uDensity : NoOfDensityBits;
|
||||
Type m_uMaterial : NoOfMaterialBits;
|
||||
Type m_uDensity : NoOfDensityBits;
|
||||
};
|
||||
|
||||
template<typename Type, uint8_t NoOfMaterialBits, uint8_t NoOfDensityBits>
|
||||
|
Loading…
x
Reference in New Issue
Block a user