Merge branch 'develop' into feature/cubiquity-version

Conflicts:
	library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl
This commit is contained in:
Daviw Williams 2014-02-27 15:40:01 +01:00
commit b416dc933f
4 changed files with 42 additions and 0 deletions

View File

@ -103,6 +103,26 @@ namespace PolyVox
return 1;
}
/**
* Returns a material which is in some sense a weighted combination of the supplied materials.
*
* The Marching Cubes algotithm generates vertices which lie between voxels, and ideally the material of the vertex should be interpolated from the materials
* of the voxels. In practice, that material type is often an integer identifier (e.g. 1 = rock, 2 = soil, 3 = grass) and an interpolation doean't make sense
* (e.g. soil is not a combination or rock and grass). Therefore this default interpolation just return one material or the other, but if more advanced voxel
* types do support interpolation then it can be implemented in this function.
*/
MaterialType blendMaterials(MaterialType a, MaterialType b, float weight)
{
if(weight < 0.5f)
{
return a;
}
else
{
return b;
}
}
/**
* Returns the density value which was passed to the constructor.
*

View File

@ -168,6 +168,11 @@ namespace PolyVox
return 1;
}
MaterialType blendMaterials(MaterialType /*a*/, MaterialType /*b*/, float /*weight*/)
{
return 1;
}
DensityType getThreshold(void)
{
return m_tThreshold;

View File

@ -132,6 +132,18 @@ namespace PolyVox
return voxel.getMaterial();
}
MaterialType blendMaterials(MaterialType a, MaterialType b, float weight)
{
if(weight < 0.5f)
{
return a;
}
else
{
return b;
}
}
DensityType getThreshold(void)
{
return m_tThreshold;

View File

@ -55,6 +55,11 @@ public:
return 1;
}
float blendMaterials(float /*a*/, float /*b*/, float /*weight*/)
{
return 1;
}
float getThreshold(void)
{
return 50.0f;