Brought improved blending changes across from Cubiquity branch.
This commit is contained in:
parent
2458f94feb
commit
c5780dd8e2
@ -103,6 +103,18 @@ namespace PolyVox
|
||||
return 1;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
|
@ -168,6 +168,11 @@ namespace PolyVox
|
||||
return 1;
|
||||
}
|
||||
|
||||
MaterialType blendMaterials(MaterialType /*a*/, MaterialType /*b*/, float /*weight*/)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
DensityType getThreshold(void)
|
||||
{
|
||||
return m_tThreshold;
|
||||
|
@ -461,7 +461,7 @@ namespace PolyVox
|
||||
//volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component.
|
||||
const typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
const typename Controller::MaterialType uMaterial100 = m_controller.convertToMaterial(v100);
|
||||
const typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100);
|
||||
const typename Controller::MaterialType uMaterial = m_controller.blendMaterials(uMaterial000, uMaterial100, fInterp);
|
||||
|
||||
const PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
const uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
@ -494,7 +494,7 @@ namespace PolyVox
|
||||
//volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component.
|
||||
const typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
const typename Controller::MaterialType uMaterial010 = m_controller.convertToMaterial(v010);
|
||||
const typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial010);
|
||||
const typename Controller::MaterialType uMaterial = m_controller.blendMaterials(uMaterial000, uMaterial010, fInterp);
|
||||
|
||||
const PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
const uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
@ -526,7 +526,7 @@ namespace PolyVox
|
||||
//volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component.
|
||||
const typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
const typename Controller::MaterialType uMaterial001 = m_controller.convertToMaterial(v001);
|
||||
const typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001);
|
||||
const typename Controller::MaterialType uMaterial = m_controller.blendMaterials(uMaterial000, uMaterial001, fInterp);
|
||||
|
||||
const PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
const uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
|
@ -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;
|
||||
|
@ -55,6 +55,11 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
float blendMaterials(float /*a*/, float /*b*/, float /*weight*/)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
float getThreshold(void)
|
||||
{
|
||||
return 50.0f;
|
||||
|
Loading…
x
Reference in New Issue
Block a user