More work refactoring basic voxel types.
This commit is contained in:
@ -94,18 +94,59 @@ namespace PolyVox
|
||||
|
||||
// These types are here for backwards compatibility but they are a little ambiguous as the name doesn't indicate
|
||||
// whether the values are signed. We would recommend using one of the 8 or 16 bit predefined types above instead.
|
||||
typedef Density<uint8_t> Density8;
|
||||
typedef Density<uint16_t> Density16;
|
||||
typedef DensityU8 Density8;
|
||||
typedef DensityU16 Density16;
|
||||
|
||||
// We have to define all the min and max values explicitly here rather than using std::numeric_limits because we need
|
||||
// compile time constants. The new 'constexpr' would help here but it's not supported by all compilers at the moment.
|
||||
/*template<>
|
||||
class VoxelTypeTraits< Density<int8_t> >
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< DensityI8 >
|
||||
{
|
||||
public:
|
||||
const static int8_t MinDensity;
|
||||
const static int8_t MaxDensity;
|
||||
};*/
|
||||
const static typename DensityI8::DensityType MinDensity;
|
||||
const static typename DensityI8::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< DensityU8 >
|
||||
{
|
||||
public:
|
||||
const static typename DensityU8::DensityType MinDensity;
|
||||
const static typename DensityU8::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< DensityI16 >
|
||||
{
|
||||
public:
|
||||
const static typename DensityI16::DensityType MinDensity;
|
||||
const static typename DensityI16::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< DensityU16 >
|
||||
{
|
||||
public:
|
||||
const static typename DensityU16::DensityType MinDensity;
|
||||
const static typename DensityU16::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< DensityFloat >
|
||||
{
|
||||
public:
|
||||
const static typename DensityFloat::DensityType MinDensity;
|
||||
const static typename DensityFloat::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< DensityDouble >
|
||||
{
|
||||
public:
|
||||
const static typename DensityDouble::DensityType MinDensity;
|
||||
const static typename DensityDouble::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
/*template<>
|
||||
class VoxelTypeTraits< Density<uint8_t> >
|
||||
@ -113,9 +154,9 @@ namespace PolyVox
|
||||
public:
|
||||
const static uint8_t MinDensity;
|
||||
const static uint8_t MaxDensity;
|
||||
};*/
|
||||
};
|
||||
|
||||
/*template<>
|
||||
template<>
|
||||
class VoxelTypeTraits< Density<int16_t> >
|
||||
{
|
||||
public:
|
||||
|
@ -86,13 +86,21 @@ namespace PolyVox
|
||||
typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44;
|
||||
typedef MaterialDensityPair<uint16_t, 8, 8> MaterialDensityPair88;
|
||||
|
||||
/*template<typename Type, uint8_t NoOfMaterialBits, uint8_t NoOfDensityBits>
|
||||
class VoxelTypeTraits< MaterialDensityPair<Type, NoOfDensityBits, NoOfMaterialBits> >
|
||||
template<>
|
||||
class VoxelTypeTraits< MaterialDensityPair44 >
|
||||
{
|
||||
public:
|
||||
const static Type MinDensity = 0;
|
||||
const static Type MaxDensity = (0x01 << NoOfDensityBits) - 1;
|
||||
};*/
|
||||
const static typename MaterialDensityPair44::DensityType MinDensity;
|
||||
const static typename MaterialDensityPair44::DensityType MaxDensity;
|
||||
};
|
||||
|
||||
template<>
|
||||
class VoxelTypeTraits< MaterialDensityPair88 >
|
||||
{
|
||||
public:
|
||||
const static typename MaterialDensityPair88::DensityType MinDensity;
|
||||
const static typename MaterialDensityPair88::DensityType MaxDensity;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -68,8 +68,8 @@ namespace PolyVox
|
||||
class VoxelTypeTraits
|
||||
{
|
||||
public:
|
||||
const static typename Type::DensityType MinDensity;
|
||||
const static typename Type::DensityType MaxDensity;
|
||||
const static Type MinDensity;
|
||||
const static Type MaxDensity;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user