Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Todd Kordenbrock
VTK-m
Commits
82a573f7
Commit
82a573f7
authored
Jan 04, 2016
by
Robert Maynard
Browse files
MarchingCubes is now able to not generate normals.
parent
502e7c28
Changes
2
Hide whitespace changes
Inline
Side-by-side
vtkm/worklet/MarchingCubes.h
View file @
82a573f7
...
...
@@ -129,9 +129,11 @@ public:
VTKM_CONT_EXPORT
IsosurfaceGenerate
(
FieldType
isovalue
,
bool
generateNormals
,
const
vtkm
::
worklet
::
ScatterCounting
&
scatter
,
IdPortalConstType
edgeTable
)
:
EdgeTable
(
edgeTable
),
Isovalue
(
isovalue
),
GenerateNormals
(
generateNormals
),
Scatter
(
scatter
)
{
}
template
<
typename
CellShapeTag
,
...
...
@@ -185,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
;
};
...
...
@@ -271,6 +283,7 @@ public:
vtkm
::
worklet
::
ScatterCounting
scatter
(
numOutputTrisPerCell
,
DeviceAdapter
());
IsosurfaceGenerate
isosurface
(
isovalue
,
true
,
//always generate normals.
scatter
,
edgeTable
.
PrepareForInput
(
DeviceAdapter
()));
...
...
vtkm/worklet/ScatterCounting.h
View file @
82a573f7
...
...
@@ -137,11 +137,6 @@ struct SubtractToVisitIndexKernel : vtkm::exec::FunctorBase
///
struct
ScatterCounting
{
VTKM_CONT_EXPORT
ScatterCounting
()
{
}
template
<
typename
CountArrayType
,
typename
Device
>
VTKM_CONT_EXPORT
ScatterCounting
(
const
CountArrayType
&
countArray
,
Device
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment