Commit 34ad5209 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot
Browse files

Merge topic 'marching_cubes_normal_generation_option'

82a573f7 MarchingCubes is now able to not generate normals.
502e7c28 Merge branch 'cleanup_scatter_counting_uses' into marching_cubes_normal_generation_option
8079dc28 MarchingCubes generate step now requires a ScatterCounting object.
4cd2f582

 Add a default constructor for ScatterCounting.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland's avatarKenneth Moreland <kmorel@sandia.gov>
Merge-request: !300
parents 378004f6 82a573f7
......@@ -127,15 +127,14 @@ public:
return this->Scatter;
}
template<typename CountArrayType, typename Device>
VTKM_CONT_EXPORT
IsosurfaceGenerate(FieldType isovalue,
const CountArrayType &countArray,
Device,
bool generateNormals,
const vtkm::worklet::ScatterCounting& scatter,
IdPortalConstType edgeTable) : EdgeTable(edgeTable),
Isovalue(isovalue),
Scatter(countArray,
Device()) { }
GenerateNormals(generateNormals),
Scatter(scatter) { }
template<typename CellShapeTag,
typename FieldInType, // Vec-like, one per input point
......@@ -188,25 +187,35 @@ public:
vertexOut[triVertex] = vtkm::Lerp(coords[edgeVertex0],
coords[edgeVertex1],
interpolant);
const vtkm::Vec<vtkm::FloatDefault,3> edgePCoord0 =
vtkm::exec::ParametricCoordinatesPoint(
fieldIn.GetNumberOfComponents(), edgeVertex0, shape, *this);
const vtkm::Vec<vtkm::FloatDefault,3> edgePCoord1 =
vtkm::exec::ParametricCoordinatesPoint(
fieldIn.GetNumberOfComponents(), edgeVertex1, shape, *this);
const vtkm::Vec<vtkm::FloatDefault,3> interpPCoord =
vtkm::Lerp(edgePCoord0, edgePCoord1, interpolant);
normalsOut[triVertex] =
vtkm::Normal(vtkm::exec::CellDerivative(
fieldIn, coords, interpPCoord, shape, *this));
interpolationIds[triVertex][0] = indices[edgeVertex0];
interpolationIds[triVertex][1] = indices[edgeVertex1];
interpolationWeights[triVertex] = interpolant;
//conditionally do these only if we want to generate normals
if(this->GenerateNormals)
{
const vtkm::Vec<vtkm::FloatDefault,3> edgePCoord0 =
vtkm::exec::ParametricCoordinatesPoint(
fieldIn.GetNumberOfComponents(), edgeVertex0, shape, *this);
const vtkm::Vec<vtkm::FloatDefault,3> edgePCoord1 =
vtkm::exec::ParametricCoordinatesPoint(
fieldIn.GetNumberOfComponents(), edgeVertex1, shape, *this);
const vtkm::Vec<vtkm::FloatDefault,3> interpPCoord =
vtkm::Lerp(edgePCoord0, edgePCoord1, interpolant);
normalsOut[triVertex] =
vtkm::Normal(vtkm::exec::CellDerivative(
fieldIn, coords, interpPCoord, shape, *this));
}
}
}
private:
const FieldType Isovalue;
bool GenerateNormals;
ScatterType Scatter;
};
......@@ -272,9 +281,10 @@ public:
numOutputTrisPerCell,
numTrianglesTable);
vtkm::worklet::ScatterCounting scatter(numOutputTrisPerCell, DeviceAdapter());
IsosurfaceGenerate isosurface(isovalue,
numOutputTrisPerCell,
DeviceAdapter(),
true, //always generate normals.
scatter,
edgeTable.PrepareForInput(DeviceAdapter()));
vtkm::worklet::DispatcherMapTopology<IsosurfaceGenerate, DeviceAdapter>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment