Fixes to the way the marching cubes controller is used.
This commit is contained in:
parent
b140e16083
commit
66035c6d13
@ -208,11 +208,9 @@ namespace PolyVox
|
||||
Region m_regSliceCurrent;
|
||||
|
||||
//Our threshold value
|
||||
//typename VoxelTypeTraits<typename VolumeType::VoxelType>::DensityType m_tThreshold;
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::DensityType m_tThreshold;
|
||||
typename Controller::DensityType m_tThreshold;
|
||||
|
||||
//Used to convert arbitrary voxel types in densities and materials.
|
||||
//DefaultMarchingCubesController<typename VolumeType::VoxelType> m_controller;
|
||||
Controller m_controller;
|
||||
};
|
||||
}
|
||||
|
@ -444,9 +444,9 @@ namespace PolyVox
|
||||
//Choose one of the two materials to use for the vertex (we don't interpolate as interpolation of
|
||||
//material IDs does not make sense). We take the largest, so that if we are working on a material-only
|
||||
//volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component.
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial100 = m_controller.convertToMaterial(v100);
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100);
|
||||
typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
typename Controller::MaterialType uMaterial100 = m_controller.convertToMaterial(v100);
|
||||
typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial100);
|
||||
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
@ -470,9 +470,9 @@ namespace PolyVox
|
||||
//Choose one of the two materials to use for the vertex (we don't interpolate as interpolation of
|
||||
//material IDs does not make sense). We take the largest, so that if we are working on a material-only
|
||||
//volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component.
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial010 = m_controller.convertToMaterial(v010);
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial010);
|
||||
typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
typename Controller::MaterialType uMaterial010 = m_controller.convertToMaterial(v010);
|
||||
typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial010);
|
||||
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
@ -496,9 +496,9 @@ namespace PolyVox
|
||||
//Choose one of the two materials to use for the vertex (we don't interpolate as interpolation of
|
||||
//material IDs does not make sense). We take the largest, so that if we are working on a material-only
|
||||
//volume we get the one which is non-zero. Both materials can be non-zero if our volume has a density component.
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial001 = m_controller.convertToMaterial(v001);
|
||||
typename DefaultMarchingCubesController<typename VolumeType::VoxelType>::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001);
|
||||
typename Controller::MaterialType uMaterial000 = m_controller.convertToMaterial(v000);
|
||||
typename Controller::MaterialType uMaterial001 = m_controller.convertToMaterial(v001);
|
||||
typename Controller::MaterialType uMaterial = (std::max)(uMaterial000, uMaterial001);
|
||||
|
||||
PositionMaterialNormal surfaceVertex(v3dPosition, v3dNormal, static_cast<float>(uMaterial));
|
||||
uint32_t uLastVertexIndex = m_meshCurrent->addVertex(surfaceVertex);
|
||||
|
@ -42,6 +42,9 @@ using namespace PolyVox;
|
||||
class CustomMarchingCubesController
|
||||
{
|
||||
public:
|
||||
typedef float DensityType;
|
||||
typedef float MaterialType;
|
||||
|
||||
float convertToDensity(float voxel)
|
||||
{
|
||||
return voxel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user