Commit 2bb64e65 authored by Matt Larsen's avatar Matt Larsen

fixing opacity for veritical bar

parent 80081f2a
......@@ -207,10 +207,12 @@ struct DrawColorBar : public vtkm::worklet::WorkletMapField
{
// local bar coord
vtkm::Id x = index % BarWidth;
vtkm::Id y = index / BarWidth, yLocal = y;
vtkm::Id y = index / BarWidth;
vtkm::Id sample = Horizontal ? x : y;
vtkm::Vec<vtkm::Float32, 4> color = colorMap.Get(sample);
vtkm::Float32 normalizedHeight =
Horizontal ? vtkm::Float32(y) / BarHeight : vtkm::Float32(BarWidthx) / BarWidth;
// offset to global image coord
x += BarBottomLeft[0];
y += BarBottomLeft[1];
......@@ -218,7 +220,7 @@ struct DrawColorBar : public vtkm::worklet::WorkletMapField
vtkm::Id offset = y * ImageWidth + x;
// If the colortable has alpha values, we blend each color sample with translucent white.
// The height of the resultant translucent bar indicates the opacity.
vtkm::Float32 normalizedHeight = static_cast<vtkm::Float32>(yLocal) / BarHeight;
//vtkm::Float32 normalizedHeight = static_cast<vtkm::Float32>(yLocal) / BarHeight;
if (color[3] < 1.0f && normalizedHeight <= color[3])
{
vtkm::Float32 intensity = 0.4f;
......@@ -234,6 +236,8 @@ struct DrawColorBar : public vtkm::worklet::WorkletMapField
}
else
{
// make sure this is opaque
color[3] = 1.f;
frameBuffer.Set(offset, color);
}
}
......
Markdown is supported
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